Package org.apache.lucene.sandbox.search
Class PhraseWildcardQuery.SegmentTermsSizeComparator
- java.lang.Object
-
- org.apache.lucene.sandbox.search.PhraseWildcardQuery.SegmentTermsSizeComparator
-
- All Implemented Interfaces:
java.util.Comparator<LeafReaderContext>
- Enclosing class:
- PhraseWildcardQuery
protected class PhraseWildcardQuery.SegmentTermsSizeComparator extends java.lang.Object implements java.util.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 Modifier and Type Field Description private static java.lang.String
COMPARISON_ERROR_MESSAGE
-
Constructor Summary
Constructors Modifier Constructor Description protected
SegmentTermsSizeComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(LeafReaderContext leafReaderContext1, LeafReaderContext leafReaderContext2)
protected java.util.List<LeafReaderContext>
createTermsSizeSortedCopyOf(java.util.List<LeafReaderContext> segments)
private long
getTermsSize(LeafReaderContext leafReaderContext)
-
-
-
Field Detail
-
COMPARISON_ERROR_MESSAGE
private static final java.lang.String COMPARISON_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
compare
public int compare(LeafReaderContext leafReaderContext1, LeafReaderContext leafReaderContext2)
- Specified by:
compare
in interfacejava.util.Comparator<LeafReaderContext>
-
createTermsSizeSortedCopyOf
protected java.util.List<LeafReaderContext> createTermsSizeSortedCopyOf(java.util.List<LeafReaderContext> segments) throws java.io.IOException
- Throws:
java.io.IOException
-
getTermsSize
private long getTermsSize(LeafReaderContext leafReaderContext) throws java.io.IOException
- Throws:
java.io.IOException
-
-