Package org.apache.lucene.sandbox.search
Class PhraseWildcardQuery.SegmentTermsSizeComparator
java.lang.Object
org.apache.lucene.sandbox.search.PhraseWildcardQuery.SegmentTermsSizeComparator
- All Implemented Interfaces:
Comparator<LeafReaderContext>
- Enclosing class:
- PhraseWildcardQuery
protected class PhraseWildcardQuery.SegmentTermsSizeComparator
extends Object
implements Comparator<LeafReaderContext>
Compares segments based of the number of terms they contain.
This is used to sort segments incrementally by number of terms. This way the first segment to search is the smallest, so a term has the lowest probability to match in this segment. And if the term does not match, we credit unused expansions when searching the other next segments.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(LeafReaderContext leafReaderContext1, LeafReaderContext leafReaderContext2) protected List<LeafReaderContext>
createTermsSizeSortedCopyOf
(List<LeafReaderContext> segments) private long
getTermsSize
(LeafReaderContext leafReaderContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
COMPARISON_ERROR_MESSAGE
- See Also:
-
-
Constructor Details
-
SegmentTermsSizeComparator
protected SegmentTermsSizeComparator()
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<LeafReaderContext>
-
createTermsSizeSortedCopyOf
protected List<LeafReaderContext> createTermsSizeSortedCopyOf(List<LeafReaderContext> segments) throws IOException - Throws:
IOException
-
getTermsSize
- Throws:
IOException
-