public override IList <IndexFile> Search(SearchingOptions options) { // var analyzer = new SpanishAnalyzer(LuceneVersion.LUCENE_48); var analyzer = new StandardAnalyzer(LuceneVersion.LUCENE_48); var phrase = new MultiPhraseQuery(); phrase.Add(new Term("contents", options.SearchTerm)); var indexConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer); var indexDir = Path.Combine(options.DataDir, ".luceneindex"); var dir = FSDirectory.Open(indexDir); var dirReader = DirectoryReader.Open(dir); using (var writer = new IndexWriter(dir, indexConfig)) { var searcher = new IndexSearcher(writer.GetReader(true)); var hits = searcher.Search(phrase, options.DocCount).ScoreDocs; var indexFileList = from ScoreDoc hit in hits let doc = searcher.Doc(hit.Doc) select new IndexFile { Score = hit.Score, Path = doc.Get("path"), Modified = doc.Get("modified") }; var result = indexFileList.ToList(); return(result); } }
public abstract IList <IndexFile> Search(SearchingOptions options);
public override IList <IndexFile> Search(SearchingOptions options) { throw new NotImplementedException(); }