DisiPriorityQueue (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.search, class: DisiPriorityQueue

Package org.apache.lucene.search

# Class DisiPriorityQueue

java.lang.Object
org.apache.lucene.search.DisiPriorityQueue

All Implemented Interfaces:
  `Iterable<DisiWrapper>`

public abstract sealed class DisiPriorityQueue extends Object implements Iterable<DisiWrapper>
A priority queue of DocIdSetIterators that orders by current doc ID. This specialization is needed over `PriorityQueue` because the pluggable comparison function makes the rebalancing quite slow.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DisiPriorityQueue()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract DisiWrapper`
  `add(DisiWrapper entry)`
  Add a `DisiWrapper` to this queue and return the top entry.
  `void`
  `addAll(DisiWrapper[] entries, int offset, int len)`
  Bulk add.
  `abstract void`
  `clear()`
  Clear the heap.
  `static DisiPriorityQueue`
  `ofMaxSize(int maxSize)`
  Create a `DisiPriorityQueue` of the given maximum size.
  `abstract DisiWrapper`
  `pop()`
  Remove the top entry and return it.
  `abstract int`
  `size()`
  Return the number of entries in this heap.
  `abstract DisiWrapper`
  `top()`
  Return top value in this heap, or null if the heap is empty.
  `abstract DisiWrapper`
  `top2()`
  Return the 2nd least value in this heap, or null if the heap contains less than 2 values.
  `abstract DisiWrapper`
  `topList()`
  Get the list of scorers which are on the current doc.
  `abstract DisiWrapper`
  `updateTop()`
  Rebalance this heap and return the top entry.

  ### 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, iterator, spliterator`

- ## Constructor Details

  - ### DisiPriorityQueue

    public DisiPriorityQueue()

- ## Method Details

  - ### ofMaxSize

    public static DisiPriorityQueue ofMaxSize(int maxSize)
    Create a `DisiPriorityQueue` of the given maximum size.

  - ### size

    public abstract int size()
    Return the number of entries in this heap.

  - ### top

    public abstract DisiWrapper top()
    Return top value in this heap, or null if the heap is empty.

  - ### top2

    public abstract DisiWrapper top2()
    Return the 2nd least value in this heap, or null if the heap contains less than 2 values.

  - ### topList

    public abstract DisiWrapper topList()
    Get the list of scorers which are on the current doc.

  - ### add

    public abstract DisiWrapper add(DisiWrapper entry)
    Add a `DisiWrapper` to this queue and return the top entry.

  - ### addAll

    public void addAll(DisiWrapper[] entries, int offset, int len)
    Bulk add.

  - ### pop

    public abstract DisiWrapper pop()
    Remove the top entry and return it.

  - ### updateTop

    public abstract DisiWrapper updateTop()
    Rebalance this heap and return the top entry.

  - ### clear

    public abstract void clear()
    Clear the heap.