public void Initialize(LuceneIndexerOptions indexerOptions, TContext entity, bool overrideIfExists = false) { if (isInitialized == false || overrideIfExists == true) { initializeLucene(indexerOptions); } Context = entity; contextInterface = Context as DbContext; }
public void Initialize(LuceneIndexerOptions indexerOptions, bool overrideIfExists = false) { if (isInitialized == false || overrideIfExists == true) { initializeLucene(indexerOptions); } Context = new TContext(); contextInterface = Context as DbContext; //Context = new CTX(); //contextInterface = Context as IDbContext; }
/// <summary> /// Initialize Lucene /// Sets up the directory, analyzer, indexer and searcher /// </summary> /// <param name="options"></param> private void initializeLucene(LuceneIndexerOptions options) { // create the directory if (options.UseRamDirectory == true) { directory = new RAMDirectory(); } else { if (directory == null) { directory = FSDirectory.Open(options.Path); } } // create the analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48); // create the indexer indexer = new LuceneIndexer(directory, analyzer, options.MaximumFieldLength); // create the searcher searcher = new LuceneIndexSearcher(directory, analyzer); }