Package org.apache.lucene.search
Class TotalHitCountCollector
- java.lang.Object
-
- org.apache.lucene.search.TotalHitCountCollector
-
- All Implemented Interfaces:
Collector
public class TotalHitCountCollector extends Object implements Collector
Just counts the total number of hits. This is the collector behindIndexSearcher.count(org.apache.lucene.search.Query). When theWeightimplementsWeight.count(org.apache.lucene.index.LeafReaderContext), this collector will skip collecting segments.
-
-
Constructor Summary
Constructors Constructor Description TotalHitCountCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeafCollectorgetLeafCollector(LeafReaderContext context)Create a newcollectorto collect the given context.intgetTotalHits()Returns how many hits matched the search.ScoreModescoreMode()Indicates what features are required from the scorer.voidsetWeight(Weight weight)Set theWeightthat will be used to produce scorers that will feedLeafCollectors.
-
-
-
Method Detail
-
getTotalHits
public int getTotalHits()
Returns how many hits matched the search.
-
scoreMode
public ScoreMode scoreMode()
Description copied from interface:CollectorIndicates what features are required from the scorer.
-
setWeight
public void setWeight(Weight weight)
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
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
Description copied from interface:CollectorCreate a newcollectorto collect the given context.- Specified by:
getLeafCollectorin interfaceCollector- Parameters:
context- next atomic reader context- Throws:
IOException
-
-