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
-
Method Summary
Modifier and TypeMethodDescriptiongetLeafCollector
(LeafReaderContext context) Create a newcollector
to collect the given context.int
Returns how many hits matched the search.Indicates what features are required from the scorer.void
Set theWeight
that will be used to produce scorers that will feedLeafCollector
s.
-
Constructor Details
-
TotalHitCountCollector
public TotalHitCountCollector()
-
-
Method Details
-
getTotalHits
public int getTotalHits()Returns how many hits matched the search. -
scoreMode
Description copied from interface:Collector
Indicates what features are required from the scorer. -
setWeight
Description copied from interface:Collector
Set theWeight
that will be used to produce scorers that will feedLeafCollector
s. 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:Collector
Create a newcollector
to collect the given context.- Specified by:
getLeafCollector
in interfaceCollector
- Parameters:
context
- next atomic reader context- Throws:
IOException
-