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

Package org.apache.lucene.index

# Class SegmentOrder

java.lang.Object
org.apache.lucene.index.SegmentOrder

public abstract class SegmentOrder extends Object
Utility class to re-order segments within an IndexReader to assist in early termination.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SegmentOrder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SegmentOrder`
  `fromSort(Sort sort)`
  Builds a SegmentSorter that will reorder segments based on a given numeric Sort, such that higher-sorting hits are more likely to be visited first, allowing early termination to more efficiently skip whole segments.
  `abstract IndexReader`
  `reorder(IndexReader reader)`
  Produces a new view over an IndexReader by re-ordering the reader's segments

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

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

- ## Constructor Details

  - ### SegmentOrder

    public SegmentOrder()

- ## Method Details

  - ### reorder

    public abstract IndexReader reorder(IndexReader reader) throws IOException
    Produces a new view over an IndexReader by re-ordering the reader's segments
    Throws:
      `IOException`

  - ### fromSort

    public static SegmentOrder fromSort(Sort sort)
    Builds a SegmentSorter that will reorder segments based on a given numeric Sort, such that higher-sorting hits are more likely to be visited first, allowing early termination to more efficiently skip whole segments. If the primary SortField of the Sort is not numeric then the returned SegmentSorter will have no effect.