我在我的 Web 应用程序中使用 Lucene.net。一切正常,但现在我必须在 hits 数组的每个文档中显示我的“搜索字符串”的出现次数。我怎样才能做到这一点?我使用通常的 BooleanQuery。
那是我的搜索:
BooleanQuery bq = new BooleanQuery();
bq.Add(QueryParser.Parse(Lquery, "", CurIndexDescritor.GetLangAnalizer()), false,false);
BooleanQuery.SetMaxClauseCount(int.MaxValue);
IndexSearcher searcher = new IndexSearcher(indexPath);
Hits hits = (filter != null) ? searcher.Search(bq, filter) : searcher.Search(bq);
for (int i = 0; i < hits.Length(); i++)
{
Document doc = hits.Doc(i);
SearchResultItem MyDb = new SearchResultItem();
MyDb.key = doc.Get(KeyField);
MyDb.score = hits.Score(i);
result.Add(MyDb);
}
我在哪里可以获得出现次数?
谢谢!