# Package org.apache.lucene.search.intervals

Intervals queries

See: Description

- Class Summary
  Class | Description
  --- | ---
  FilteredIntervalsSource | An IntervalsSource that filters the intervals from another IntervalsSource
  IntervalFilter | Wraps an `IntervalIterator` and passes through those intervals that match the `IntervalFilter.accept()` function
  IntervalIterator | A `DocIdSetIterator` that also allows iteration over matching intervals in a document.
  IntervalQuery | A query that retrieves documents containing intervals returned from an `IntervalsSource` Static constructor functions for various different sources can be found in the `Intervals` class Scores for this query are computed as a function of the sloppy frequency of intervals appearing in a particular document.
  Intervals | Constructor functions for `IntervalsSource` types These sources implement minimum-interval algorithms taken from the paper Efficient Optimally Lazy Algorithms for Minimal-Interval Semantics
  IntervalsSource | 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

## Package org.apache.lucene.search.intervals Description

## Intervals queries

This package contains experimental classes to search over intervals within fields

## IntervalsSource

The `IntervalsSource` class can be used to construct proximity relationships between terms and intervals. They can be built using static methods in the `Intervals` class

### Basic intervals

- `Intervals.term(String)` — Represents a single term
- `Intervals.phrase(java.lang.String...)` — Represents a phrase
- `Intervals.ordered(org.apache.lucene.search.intervals.IntervalsSource...)` — Represents an interval over an ordered set of terms or intervals
- `Intervals.unordered(org.apache.lucene.search.intervals.IntervalsSource...)` — Represents an interval over an unordered set of terms or intervals
- `Intervals.or(org.apache.lucene.search.intervals.IntervalsSource...)` — Represents the disjunction of a set of terms or intervals

### Filters

- `Intervals.maxwidth(int, org.apache.lucene.search.intervals.IntervalsSource)` — Filters out intervals that are larger than a set width
- `Intervals.maxgaps(int, org.apache.lucene.search.intervals.IntervalsSource)` — Filters out intervals that have more than a set number of gaps between their constituent sub-intervals
- `Intervals.containedBy(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)` — Returns intervals that are contained by another interval
- `Intervals.notContainedBy(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)` — Returns intervals that are *not* contained by another interval
- `Intervals.containing(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)` — Returns intervals that contain another interval
- `Intervals.notContaining(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)` — Returns intervals that do not contain another interval
- `Intervals.nonOverlapping(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)` — Returns intervals that do not overlap with another interval
- `Intervals.notWithin(org.apache.lucene.search.intervals.IntervalsSource, int, org.apache.lucene.search.intervals.IntervalsSource)` — Returns intervals that do not appear within a set number of positions of another interval

## IntervalQuery

An `IntervalQuery` takes a field name and an `IntervalsSource`, and matches all documents that contain intervals defined by the source in that field.

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