Hits Object Deprecated in Lucene.Net 3.03, how do I replace it?

I am making my way through lucene and the dead end on this subject with the Hits object. I have use Lucene.Net.Search, but for some reason VS12 Express cannot find the Hits object, so the following fails to compile.

The compiler complains about this line

Hits hits = searcher.Search(booleanQuery, hits_limit); 

with the following error message

Error 1 The type or namespace name 'Hits' could not be found (are you missing the using directive or assembly reference?)

I don't understand, according to the online tutorials you need, Lucnen.Net.Search

Any advice

 // validation if (subqueries.Count == 0) return new List<MATS_Doc>(); // set up lucene searcher Searcher searcher = new IndexSearcher(_directory, false); var hits_limit = 1000; var analyzer = new StandardAnalyzer(Version.LUCENE_30); BooleanQuery booleanQuery = new BooleanQuery(); foreach (Query fieldQuery in subqueries) { booleanQuery.Add(fieldQuery, Occur.SHOULD); } //var parser = new QueryParser(Version.LUCENE_30, searchField, analyzer); //var query = _parseQuery(searchQuery, parser); Hits hits = searcher.Search(booleanQuery, hits_limit); IEnumerable<MATS_Doc> results = _mapLuceneSearchResultsToDataList(hits, searcher); analyzer.Close(); searcher.Dispose(); return results; 
+6
source share
1 answer

I am using Lucene.net 3.0.3, and Search () returns a TopDocs object that contains several properties and an array of ScoreDoc elements. Here is an example:

 Lucene.Net.Search.TopDocs results = searcher.Search(booleanQuery, null, hits_limit); foreach(ScoreDoc scoreDoc in results.ScoreDocs){ // retrieve the document from the 'ScoreDoc' object Lucene.Net.Documents.Document doc = searcher.Doc(scoreDoc.Doc); string myFieldValue = doc.get("myField"); } 
+15
source

All Articles