Package org.apache.lucene.search
Class TotalHitCountCollectorManager
- java.lang.Object
-
- org.apache.lucene.search.TotalHitCountCollectorManager
-
- All Implemented Interfaces:
CollectorManager<TotalHitCountCollector,Integer>
public class TotalHitCountCollectorManager extends Object implements CollectorManager<TotalHitCountCollector,Integer>
Collector manager based onTotalHitCountCollectorthat allows users to parallelize counting the number of hits, expected to be used mostly wrapped inMultiCollectorManager. For cases when this is the only collector manager used,IndexSearcher.count(Query)should be called instead ofIndexSearcher.search(Query, CollectorManager)as the former is faster whenever the count can be returned directly from the index statistics.
-
-
Constructor Summary
Constructors Constructor Description TotalHitCountCollectorManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TotalHitCountCollectornewCollector()Return a newCollector.Integerreduce(Collection<TotalHitCountCollector> collectors)Reduce the results of individual collectors into a meaningful result.
-
-
-
Method Detail
-
newCollector
public TotalHitCountCollector newCollector() throws IOException
Description copied from interface:CollectorManagerReturn a newCollector. This must return a different instance on each call.- Specified by:
newCollectorin interfaceCollectorManager<TotalHitCountCollector,Integer>- Throws:
IOException
-
reduce
public Integer reduce(Collection<TotalHitCountCollector> collectors) throws IOException
Description copied from interface:CollectorManagerReduce the results of individual collectors into a meaningful result. For instance aTopDocsCollectorwould compute thetop docsof each collector and then merge them usingTopDocs.merge(int, TopDocs[]). This method must be called after collection is finished on all provided collectors.- Specified by:
reducein interfaceCollectorManager<TotalHitCountCollector,Integer>- Throws:
IOException
-
-