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.

- - ### 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 List<LeafReaderContext>` | `createTermsSizeSortedCopyOf​(List<LeafReaderContext> segments)` |

    - ### 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`

- - ### Constructor Detail

    - #### SegmentTermsSizeComparator

          protected SegmentTermsSizeComparator()

  - ### Method Detail

    - #### compare

          public int compare​(LeafReaderContext leafReaderContext1,
                             LeafReaderContext leafReaderContext2)

      Specified by:
        `compare` in interface `Comparator<LeafReaderContext>`

    - #### createTermsSizeSortedCopyOf

          protected List<LeafReaderContext> createTermsSizeSortedCopyOf​(List<LeafReaderContext> segments)
                                                                 throws IOException

      Throws:
        `IOException`