Package org.apache.lucene.search
Class TotalHitCountCollector
java.lang.Object
org.apache.lucene.search.TotalHitCountCollector
- All Implemented Interfaces:
Collector
Just counts the total number of hits. This is the collector behind
IndexSearcher.count(org.apache.lucene.search.Query).
When the Weight implements Weight.count(org.apache.lucene.index.LeafReaderContext), this collector will skip collecting
segments.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final LeafCollectorgetLeafCollector(LeafReaderContext context) Create a newcollectorto collect the given context.intReturns how many hits matched the search.Indicates what features are required from the scorer.voidSet theWeightthat will be used to produce scorers that will feedLeafCollectors.
-
Constructor Details
-
TotalHitCountCollector
public TotalHitCountCollector()
-
-
Method Details
-
getTotalHits
public int getTotalHits()Returns how many hits matched the search. -
scoreMode
Description copied from interface:CollectorIndicates what features are required from the scorer. -
setWeight
Description copied from interface:CollectorSet theWeightthat will be used to produce scorers that will feedLeafCollectors. This is typically useful to have access toWeight.count(org.apache.lucene.index.LeafReaderContext)fromCollector.getLeafCollector(org.apache.lucene.index.LeafReaderContext). -
getLeafCollector
Description copied from interface:CollectorCreate a newcollectorto collect the given context.- Specified by:
getLeafCollectorin interfaceCollector- Parameters:
context- next atomic reader context- Throws:
IOException
-
createLeafCollector
-