Package org.apache.lucene.search
Class EarlyTerminatingSortingCollector
- java.lang.Object
-
- org.apache.lucene.search.FilterCollector
-
- org.apache.lucene.search.EarlyTerminatingSortingCollector
-
- All Implemented Interfaces:
Collector
@Deprecated public class EarlyTerminatingSortingCollector extends FilterCollector
Deprecated.Pass trackTotalHits=false toTopFieldCollector
instead of using this class.ACollector
that early terminates collection of documents on a per-segment basis, if the segment was sorted according to the givenSort
.NOTE: the
Collector
detects segments sorted according to a anIndexWriterConfig.setIndexSort(org.apache.lucene.search.Sort)
. Also, it collects up to a specifiednumDocsToCollect
from each segment, and therefore is mostly suitable for use in conjunction with collectors such asTopDocsCollector
, and not e.g.TotalHitCountCollector
.NOTE: If you wrap a
TopDocsCollector
that sorts in the same order as the index order, the returnedTopDocs
will be correct. However the total ofhit count
will be vastly underestimated since not all matching documents will have been collected.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
numDocsToCollect
Deprecated.Number of documents to collect in each segmentprotected Sort
sort
Deprecated.Sort used to sort the search results-
Fields inherited from class org.apache.lucene.search.FilterCollector
in
-
-
Constructor Summary
Constructors Constructor Description EarlyTerminatingSortingCollector(Collector in, Sort sort, int numDocsToCollect)
Deprecated.Create a newEarlyTerminatingSortingCollector
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
canEarlyTerminate(Sort searchSort, Sort mergePolicySort)
Deprecated.LeafCollector
getLeafCollector(LeafReaderContext context)
Deprecated.Create a newcollector
to collect the given context.boolean
terminatedEarly()
Deprecated.-
Methods inherited from class org.apache.lucene.search.FilterCollector
needsScores, toString
-
-
-
-
Field Detail
-
sort
protected final Sort sort
Deprecated.Sort used to sort the search results
-
numDocsToCollect
protected final int numDocsToCollect
Deprecated.Number of documents to collect in each segment
-
-
Constructor Detail
-
EarlyTerminatingSortingCollector
public EarlyTerminatingSortingCollector(Collector in, Sort sort, int numDocsToCollect)
Deprecated.Create a newEarlyTerminatingSortingCollector
instance.- Parameters:
in
- the collector to wrapsort
- the sort you are sorting the search results onnumDocsToCollect
- the number of documents to collect on each segment. When wrapping aTopDocsCollector
, this number should be the number of hits.- Throws:
IllegalArgumentException
- if the sort order doesn't allow for early termination with the given merge policy.
-
-
Method Detail
-
canEarlyTerminate
public static boolean canEarlyTerminate(Sort searchSort, Sort mergePolicySort)
Deprecated.
-
getLeafCollector
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
Deprecated.Description copied from interface:Collector
Create a newcollector
to collect the given context.- Specified by:
getLeafCollector
in interfaceCollector
- Overrides:
getLeafCollector
in classFilterCollector
- Parameters:
context
- next atomic reader context- Throws:
IOException
-
terminatedEarly
public boolean terminatedEarly()
Deprecated.
-
-