Class 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 Detail

      • COMPARISON_ERROR_MESSAGE

        private static final java.lang.String COMPARISON_ERROR_MESSAGE
        See Also:
        Constant Field Values
    • Constructor Detail

      • SegmentTermsSizeComparator

        protected SegmentTermsSizeComparator()
    • Method Detail

      • 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