本文整理汇总了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);
}
}