简体   繁体   English

Lucene.NET中的分组搜索

[英]Grouped Search in Lucene.NET

I would like to transfer the following example of a grouped search of the Lucene documentation to .NET. 我想将Lucene文档的分组搜索的以下示例传输到.NET。 I am using Lucene.NET in version 3.0.3.0: 我在版本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;
}

As far as I've managed to find out, the grouped search is not implemented in Lucene.NET. 据我设法找出来,在Lucene.NET中没有实现分组搜索。

a) Is that correct? a)正确吗? b) If yes, what would be the way to go to build a substitute? b)如果是,建立替代品的方法是什么?

If the amount of possible groups is not large you can use Faceted search, it's implemented in Lucene.Net 3.0. 如果可能的组数量不多,则可以使用多面搜索,它是在Lucene.Net 3.0中实现的。 https://cwiki.apache.org/confluence/display/LUCENENET/Simple+Faceted+Search The default limitation is 2048 facets (groups). https://cwiki.apache.org/confluence/display/LUCENENET/Simple+Faceted+Search默认限制为2048个构面(组)。 You can increase it but this will increase memory usage. 您可以增加它,但这会增加内存使用量。

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

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