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

Package org.apache.lucene.search

# Class ConjunctionUtils

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

public final class ConjunctionUtils extends Object
Helper methods for building conjunction iterators

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConjunctionUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addIterator(DocIdSetIterator disi, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators)`
  Given a DocIdSetIterator, find any sub-iterators or two-phase iterators and add them to the provided DocIdSetIterator and TwoPhaseIterator lists
  `static void`
  `addTwoPhaseIterator(TwoPhaseIterator twoPhaseIter, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators)`
  Given a two-phase iterator, find any sub-iterators and add them to the provided DocIdSetIterator and TwoPhaseIterator lists
  `static DocIdSetIterator`
  `createConjunction(List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators)`
  Create a conjunction over the provided set of DocIdSetIterators and TwoPhaseIterators, using two-phase iterator where possible.
  `static DocIdSetIterator`
  `intersectIterators(List<? extends DocIdSetIterator> iterators)`
  Create a conjunction over the provided DocIdSetIterators.
  `static DocIdSetIterator`
  `intersectScorers(Collection<Scorer> scorers)`
  Create a conjunction over the provided `Scorer`s.

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

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

- ## Constructor Details

  - ### ConjunctionUtils

    public ConjunctionUtils()

- ## Method Details

  - ### intersectScorers

    public static DocIdSetIterator intersectScorers(Collection<Scorer> scorers)
    Create a conjunction over the provided `Scorer`s. Note that the returned `DocIdSetIterator` might leverage two-phase iteration in which case it is possible to retrieve the `TwoPhaseIterator` using `TwoPhaseIterator.unwrap(org.apache.lucene.search.DocIdSetIterator)`.

  - ### intersectIterators

    public static DocIdSetIterator intersectIterators(List<? extends DocIdSetIterator> iterators)
    Create a conjunction over the provided DocIdSetIterators. Note that the returned `DocIdSetIterator` might leverage two-phase iteration in which case it is possible to retrieve the `TwoPhaseIterator` using `TwoPhaseIterator.unwrap(org.apache.lucene.search.DocIdSetIterator)`.

  - ### createConjunction

    public static DocIdSetIterator createConjunction(List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators)
    Create a conjunction over the provided set of DocIdSetIterators and TwoPhaseIterators, using two-phase iterator where possible. Note that the returned `DocIdSetIterator` might leverage two-phase iteration in which case it is possible to retrieve the `TwoPhaseIterator` using `TwoPhaseIterator.unwrap(org.apache.lucene.search.DocIdSetIterator)`.
    Parameters:
      `allIterators` - a list of DocIdSetIterators to combine
      `twoPhaseIterators` - a list of TwoPhaseIterators to combine

  - ### addTwoPhaseIterator

    public static void addTwoPhaseIterator(TwoPhaseIterator twoPhaseIter, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators)
    Given a two-phase iterator, find any sub-iterators and add them to the provided DocIdSetIterator and TwoPhaseIterator lists

  - ### addIterator

    public static void addIterator(DocIdSetIterator disi, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators)
    Given a DocIdSetIterator, find any sub-iterators or two-phase iterators and add them to the provided DocIdSetIterator and TwoPhaseIterator lists