sqlite db file should live in LibationFiles dir, not in app dir
This commit is contained in:
parent
65dc273e12
commit
bcc237c693
17 changed files with 150 additions and 120 deletions
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using DataLayer;
|
||||
using Dinah.Core;
|
||||
using FileManager;
|
||||
|
|
@ -19,6 +18,8 @@ namespace LibationSearchEngine
|
|||
{
|
||||
public const Lucene.Net.Util.Version Version = Lucene.Net.Util.Version.LUCENE_30;
|
||||
|
||||
private LibationContext context { get; }
|
||||
|
||||
// not customizable. don't move to config
|
||||
private static string SearchEngineDirectory { get; }
|
||||
= new System.IO.DirectoryInfo(Configuration.Instance.LibationFiles).CreateSubdirectory("SearchEngine").FullName;
|
||||
|
|
@ -160,7 +161,9 @@ namespace LibationSearchEngine
|
|||
|
||||
private Directory getIndex() => FSDirectory.Open(SearchEngineDirectory);
|
||||
|
||||
public void CreateNewIndex(bool overwrite = true)
|
||||
public SearchEngine(LibationContext context) => this.context = context;
|
||||
|
||||
public void CreateNewIndex(bool overwrite = true)
|
||||
{
|
||||
// 300 products
|
||||
// 1st run after app is started: 400ms
|
||||
|
|
@ -172,7 +175,7 @@ namespace LibationSearchEngine
|
|||
|
||||
log();
|
||||
|
||||
var library = LibraryQueries.GetLibrary_Flat_NoTracking();
|
||||
var library = context.GetLibrary_Flat_NoTracking();
|
||||
|
||||
log();
|
||||
|
||||
|
|
@ -233,7 +236,7 @@ namespace LibationSearchEngine
|
|||
/// <summary>Long running. Use await Task.Run(() => UpdateBook(productId))</summary>
|
||||
public void UpdateBook(string productId)
|
||||
{
|
||||
var libraryBook = LibraryQueries.GetLibraryBook_Flat_NoTracking(productId);
|
||||
var libraryBook = context.GetLibraryBook_Flat_NoTracking(productId);
|
||||
var term = new Term(_ID_, productId);
|
||||
|
||||
var document = createBookIndexDocument(libraryBook);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue