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 theWeight
implementsWeight.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 LeafCollector
getLeafCollector(LeafReaderContext context)
Create a newcollector
to collect the given context.int
getTotalHits()
Returns how many hits matched the search.ScoreMode
scoreMode()
Indicates what features are required from the scorer.void
setWeight(Weight weight)
Set theWeight
that will be used to produce scorers that will feedLeafCollector
s.
-
-
-
Method Detail
-
getTotalHits
public int getTotalHits()
Returns how many hits matched the search.
-
scoreMode
public ScoreMode scoreMode()
Description copied from interface:Collector
Indicates what features are required from the scorer.
-
setWeight
public void setWeight(Weight weight)
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
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
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
-
-