/// <summary> /// </summary> protected override ILibrarySearchResult DoSearch(LibrarySearchCriteria criteria) { LuceneLibrarySearchCriteriaAdaptor adaptor = new LuceneLibrarySearchCriteriaAdaptor(); Query query = adaptor.BuildQuery(criteria); if (query == null) { Debug.WriteLine("LuceneIndexMgr: Query is null, returning a zero-hits result"); return(new NoHitsLibrarySearchResult()); } IndexSearcher searcher = new IndexSearcher(CurrentDirectory); Hits hits = searcher.Search(query); string tmpPathFilter = (criteria.AncestryPath == null) ? null : criteria.AncestryPath.Replace(LuceneNodeIndexer.PATH_EOL_MARKER, string.Empty); return(new LuceneLibrarySearchResult(hits, tmpPathFilter, 0.0499)); }
/// <summary> /// </summary> protected override ILibrarySearchResult DoSearch(LibrarySearchCriteria criteria) { LuceneLibrarySearchCriteriaAdaptor adaptor = new LuceneLibrarySearchCriteriaAdaptor(); Query query = adaptor.BuildQuery(criteria); if( query == null ) { Debug.WriteLine("LuceneIndexMgr: Query is null, returning a zero-hits result"); return new NoHitsLibrarySearchResult(); } IndexSearcher searcher = new IndexSearcher(CurrentDirectory); Hits hits = searcher.Search(query); string tmpPathFilter = (criteria.AncestryPath == null) ? null : criteria.AncestryPath.Replace(LuceneNodeIndexer.PATH_EOL_MARKER, string.Empty); return new LuceneLibrarySearchResult(hits, tmpPathFilter,0.0499); }
private static void AssertQueryString(string expected, LibrarySearchCriteria crit) { LuceneLibrarySearchCriteriaAdaptor adaptor = new LuceneLibrarySearchCriteriaAdaptor(); string result = adaptor.BuildQueryString(crit); Assert.AreEqual(expected, result); }