org.apache.lucene.search

## Class FieldValueHitQueue<T extends FieldValueHitQueue.Entry>

- java.lang.Object
- - org.apache.lucene.util.PriorityQueue<T>
  - - org.apache.lucene.search.FieldValueHitQueue<T>

- All Implemented Interfaces:
    Iterable<T>

      public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry>
      extends PriorityQueue<T>

  Expert: A hit queue for sorting by hits by terms in more than one field.
  Since:
    2.9
  See Also:
    `IndexSearcher.search(Query,int,Sort)`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `FieldValueHitQueue.Entry` Extension of ScoreDoc to also store the `FieldComparator` slot.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FieldComparator<?>[]` | `comparators`
    `protected SortField[]` | `fields` Stores the sort criteria being used.
    `protected int[]` | `reverseMul`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T extends FieldValueHitQueue.Entry> FieldValueHitQueue<T>` | `create(SortField[] fields, int size)` Creates a hit queue sorted by the given list of fields.
    `FieldComparator<?>[]` | `getComparators()`
    `LeafFieldComparator[]` | `getComparators(LeafReaderContext context)`
    `int[]` | `getReverseMul()`
    `protected abstract boolean` | `lessThan(FieldValueHitQueue.Entry a, FieldValueHitQueue.Entry b)` Determines the ordering of objects in this priority queue.

    - ### Methods inherited from class org.apache.lucene.util.PriorityQueue

      `add, clear, getHeapArray, insertWithOverflow, iterator, pop, remove, size, top, updateTop, updateTop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### fields

          protected final SortField[] fields

      Stores the sort criteria being used.

    - #### comparators

          protected final FieldComparator<?>[] comparators

    - #### reverseMul

          protected final int[] reverseMul

  - ### Method Detail

    - #### create

          public static <T extends FieldValueHitQueue.Entry> FieldValueHitQueue<T> create(SortField[] fields,
                                                                                          int size)

      Creates a hit queue sorted by the given list of fields.

      NOTE: The instances returned by this method pre-allocate a full array of length `numHits`.

      Parameters:
        `fields` - SortField array we are sorting by in priority order (highest priority first); cannot be `null` or empty
        `size` - The number of hits to retain. Must be greater than zero.

    - #### getComparators

          public FieldComparator<?>[] getComparators()

    - #### getReverseMul

          public int[] getReverseMul()

    - #### getComparators

          public LeafFieldComparator[] getComparators(LeafReaderContext context)
                                               throws IOException

      Throws:
        `IOException`

    - #### lessThan

          protected abstract boolean lessThan(FieldValueHitQueue.Entry a,
                                              FieldValueHitQueue.Entry b)

      Description copied from class: `PriorityQueue`
      Determines the ordering of objects in this priority queue. Subclasses must define this one method.
      Specified by:
        `lessThan` in class `PriorityQueue<T extends FieldValueHitQueue.Entry>`
      Returns:
        `true` iff parameter `a` is less than parameter `b`.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.