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 toTopFieldCollectorinstead of using this class.ACollectorthat early terminates collection of documents on a per-segment basis, if the segment was sorted according to the givenSort.NOTE: the
Collectordetects segments sorted according to a anIndexWriterConfig.setIndexSort(org.apache.lucene.search.Sort). Also, it collects up to a specifiednumDocsToCollectfrom 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
TopDocsCollectorthat sorts in the same order as the index order, the returnedTopDocswill be correct. However the total ofhit countwill be vastly underestimated since not all matching documents will have been collected.
-
-
Field Summary
Fields Modifier and Type Field Description protected intnumDocsToCollectDeprecated.Number of documents to collect in each segmentprotected SortsortDeprecated.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 newEarlyTerminatingSortingCollectorinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleancanEarlyTerminate(Sort searchSort, Sort mergePolicySort)Deprecated.LeafCollectorgetLeafCollector(LeafReaderContext context)Deprecated.Create a newcollectorto collect the given context.booleanterminatedEarly()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 newEarlyTerminatingSortingCollectorinstance.- 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:CollectorCreate a newcollectorto collect the given context.- Specified by:
getLeafCollectorin interfaceCollector- Overrides:
getLeafCollectorin classFilterCollector- Parameters:
context- next atomic reader context- Throws:
IOException
-
terminatedEarly
public boolean terminatedEarly()
Deprecated.
-
-