我正在使用以下代码在Lucene.Net中执行查询
var collector = new GroupingHitCollector(searcher.GetIndexReader());
searcher.Search(myQuery, collector);
resultsCount = collector.Hits.Count;
如何基于字段对这些搜索结果进行排序?
更新
感谢您的回答。我尝试使用TopFieldDocCollector
,但是当我将numHits
参数值设置为5000
时,出现错误提示"value is too small or too large"
。请建议一个有效的值。