use of com.yelp.nrtsearch.server.luceneserver.search.collectors.SortFieldCollector in project nrtsearch by Yelp.
the class SearchRequestProcessor method buildDocCollector.
/**
* Build {@link DocCollector} to provide the {@link org.apache.lucene.search.CollectorManager} for
* collecting hits for this query.
*
* @return collector
*/
private static DocCollector buildDocCollector(CollectorCreatorContext collectorCreatorContext) {
SearchRequest searchRequest = collectorCreatorContext.getRequest();
List<AdditionalCollectorManager<? extends Collector, ? extends CollectorResult>> additionalCollectors = searchRequest.getCollectorsMap().entrySet().stream().map(e -> CollectorCreator.getInstance().createCollectorManager(collectorCreatorContext, e.getKey(), e.getValue())).collect(Collectors.toList());
if (searchRequest.getQuerySort().getFields().getSortedFieldsList().isEmpty()) {
if (hasLargeNumHits(searchRequest)) {
return new LargeNumHitsCollector(collectorCreatorContext, additionalCollectors);
} else {
return new RelevanceCollector(collectorCreatorContext, additionalCollectors);
}
} else {
return new SortFieldCollector(collectorCreatorContext, additionalCollectors);
}
}
Aggregations