簡體   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