org.apache.lucene.queries.intervals

## Class IntervalsSource

- java.lang.Object
- - org.apache.lucene.queries.intervals.IntervalsSource

- Direct Known Subclasses:
    FilteredIntervalsSource

      public abstract class IntervalsSource
      extends Object

  A helper class for `IntervalQuery` that provides an `IntervalIterator` for a given field and segment Static constructor functions for various different sources can be found in the `Intervals` class

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntervalsSource()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract boolean` | `equals(Object other)`
    `abstract int` | `hashCode()`
    `abstract IntervalIterator` | `intervals(String field, LeafReaderContext ctx)` Create an `IntervalIterator` exposing the minimum intervals defined by this `IntervalsSource` Returns `null` if no intervals for this field exist in this segment
    `abstract IntervalMatchesIterator` | `matches(String field, LeafReaderContext ctx, int doc)` Return a `MatchesIterator` over the intervals defined by this `IntervalsSource` for a given document and field Returns `null` if no intervals exist in the given document and field
    `abstract int` | `minExtent()` Return the minimum possible width of an interval returned by this source
    `abstract Collection<IntervalsSource>` | `pullUpDisjunctions()` Expert: return the set of disjunctions that make up this IntervalsSource Most implementations can return `Collections.singleton(this)`
    `abstract String` | `toString()`
    `abstract void` | `visit(String field, QueryVisitor visitor)` Expert: visit the tree of sources

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### IntervalsSource

          public IntervalsSource()

  - ### Method Detail

    - #### intervals

          public abstract IntervalIterator intervals(String field,
                                                     LeafReaderContext ctx)
                                              throws IOException

      Create an `IntervalIterator` exposing the minimum intervals defined by this `IntervalsSource` Returns `null` if no intervals for this field exist in this segment
      Parameters:
        `field` - the field to read positions from
        `ctx` - the context for which to return the iterator
      Throws:
        `IOException`

    - #### matches

          public abstract IntervalMatchesIterator matches(String field,
                                                          LeafReaderContext ctx,
                                                          int doc)
                                                   throws IOException

      Return a `MatchesIterator` over the intervals defined by this `IntervalsSource` for a given document and field Returns `null` if no intervals exist in the given document and field
      Parameters:
        `field` - the field to read positions from
        `ctx` - the document's context
        `doc` - the document to return matches for
      Throws:
        `IOException`

    - #### visit

          public abstract void visit(String field,
                                     QueryVisitor visitor)

      Expert: visit the tree of sources

    - #### minExtent

          public abstract int minExtent()

      Return the minimum possible width of an interval returned by this source

    - #### pullUpDisjunctions

          public abstract Collection<IntervalsSource> pullUpDisjunctions()

      Expert: return the set of disjunctions that make up this IntervalsSource Most implementations can return `Collections.singleton(this)`

    - #### hashCode

          public abstract int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public abstract boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public abstract String toString()

      Overrides:
        `toString` in class `Object`

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