Package org.apache.lucene.search
Interface Collector
-
- All Known Implementing Classes:
CachingCollector,FilterCollector,MultiCollector,PositiveScoresOnlyCollector,SimpleCollector,TimeLimitingCollector,TopDocsCollector,TopFieldCollector,TopScoreDocCollector,TotalHitCountCollector
public interface CollectorExpert: Collectors are primarily meant to be used to gather raw results from a search, and implement sorting or custom result filtering, collation, etc.Lucene's core collectors are derived from
CollectorandSimpleCollector. Likely your application can use one of these classes, or subclassTopDocsCollector, instead of implementing Collector directly:TopDocsCollectoris an abstract base class that assumes you will retrieve the top N docs, according to some criteria, after collection is done.TopScoreDocCollectoris a concrete subclassTopDocsCollectorand sorts according to score + docID. This is used internally by theIndexSearchersearch methods that do not take an explicitSort. It is likely the most frequently used collector.TopFieldCollectorsubclassesTopDocsCollectorand sorts according to a specifiedSortobject (sort by field). This is used internally by theIndexSearchersearch methods that take an explicitSort.PositiveScoresOnlyCollectorwraps any other Collector and prevents collection of hits whose score is <= 0.0
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description LeafCollectorgetLeafCollector(LeafReaderContext context)Create a newcollectorto collect the given context.ScoreModescoreMode()Indicates what features are required from the scorer.default voidsetWeight(Weight weight)Set theWeightthat will be used to produce scorers that will feedLeafCollectors.
-
-
-
Method Detail
-
getLeafCollector
LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
Create a newcollectorto collect the given context.- Parameters:
context- next atomic reader context- Throws:
IOException
-
scoreMode
ScoreMode scoreMode()
Indicates what features are required from the scorer.
-
setWeight
default void setWeight(Weight weight)
Set theWeightthat will be used to produce scorers that will feedLeafCollectors. This is typically useful to have access toWeight.count(org.apache.lucene.index.LeafReaderContext)fromgetLeafCollector(org.apache.lucene.index.LeafReaderContext).
-
-