繁体   English   中英

Lucene.NET中的分组搜索

[英]Grouped Search in Lucene.NET

我想将Lucene文档的分组搜索的以下示例传输到.NET。 我在版本3.0.3.0中使用Lucene.NET:

GroupingSearch groupingSearch = new GroupingSearch("author");
groupingSearch.setGroupSort(groupSort);
groupingSearch.setFillSortFields(fillFields);

if (useCache) {
  // Sets cache in MB
  groupingSearch.setCachingInMB(4.0, true);
}

if (requiredTotalGroupCount) {
  groupingSearch.setAllGroups(true);
}

TermQuery query = new TermQuery(new Term("content", searchTerm));
TopGroups<BytesRef> result = groupingSearch.search(indexSearcher, query, groupOffset, groupLimit);

// Render groupsResult...
if (requiredTotalGroupCount) {
  int totalGroupCount = result.totalGroupCount;
}

据我设法找出来,在Lucene.NET中没有实现分组搜索。

a)正确吗? b)如果是,建立替代品的方法是什么?

如果可能的组数量不多,则可以使用多面搜索,它是在Lucene.Net 3.0中实现的。 https://cwiki.apache.org/confluence/display/LUCENENET/Simple+Faceted+Search默认限制为2048个构面(组)。 您可以增加它,但这会增加内存使用量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM