本文整理匯總了Java中org.apache.lucene.index.sorter.EarlyTerminatingSortingCollector類的典型用法代碼示例。如果您正苦於以下問題:Java EarlyTerminatingSortingCollector類的具體用法?Java EarlyTerminatingSortingCollector怎麽用?Java EarlyTerminatingSortingCollector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EarlyTerminatingSortingCollector類屬於org.apache.lucene.index.sorter包,在下文中一共展示了EarlyTerminatingSortingCollector類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: topDocs
import org.apache.lucene.index.sorter.EarlyTerminatingSortingCollector; //導入依賴的package包/類
private TopDocs topDocs(IndexSearcher searcher,
Query query,
Sort sort,
ScoreDoc after,
int count,
boolean usesRelevance) throws IOException {
if (sort == null) {
if (!usesRelevance) {
FieldDoc start = after == null ? null : (FieldDoc) after;
TopFieldCollector tfc = TopFieldCollector.create(this.sort, count, start, true, false, false, false);
Collector collector = new EarlyTerminatingSortingCollector(tfc, this.sort, count);
searcher.search(query, collector);
return tfc.topDocs();
} else {
return searcher.searchAfter(after, query, count);
}
} else {
return searcher.searchAfter(after, query, count, sort);
}
}