Package org.apache.lucene.queries.intervals
package org.apache.lucene.queries.intervals
Intervals queries
This package contains experimental classes to search over intervals within fieldsIntervalsSource
TheIntervalsSource 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 termIntervals.phrase(java.lang.String...)— Represents a phraseIntervals.ordered(IntervalsSource...)— Represents an interval over an ordered set of terms or intervalsIntervals.unordered(IntervalsSource...)— Represents an interval over an unordered set of terms or intervalsIntervals.or(IntervalsSource...)— Represents the disjunction of a set of terms or intervals
Filters
Intervals.maxwidth(int, IntervalsSource)— Filters out intervals that are larger than a set widthIntervals.maxgaps(int, IntervalsSource)— Filters out intervals that have more than a set number of gaps between their constituent sub-intervalsIntervals.containedBy(IntervalsSource, IntervalsSource)— Returns intervals that are contained by another intervalIntervals.notContainedBy(IntervalsSource, IntervalsSource)— Returns intervals that are *not* contained by another intervalIntervals.containing(IntervalsSource, IntervalsSource)— Returns intervals that contain another intervalIntervals.notContaining(IntervalsSource, IntervalsSource)— Returns intervals that do not contain another intervalIntervals.nonOverlapping(IntervalsSource, IntervalsSource)— Returns intervals that do not overlap with another intervalIntervals.notWithin(IntervalsSource, int, IntervalsSource)— Returns intervals that do not appear within a set number of positions of another interval
IntervalQuery
AnIntervalQuery takes a field name and an IntervalsSource,
and matches all documents that contain intervals defined by the source in that field.-
ClassDescriptionA conjunction of DocIdSetIterators.A priority queue of DocIdSetIterators that orders by current doc ID.A
DocIdSetIteratorwhich is a disjunction of the approximations of the provided iterators.Wraps an IntervalIterator and extends the bounds of its intervals Useful for specifying gaps in an ordered iterator; if you want to match `a b [2 spaces] c`, you can search for phrase(a, extended(b, 0, 2), c) An interval with prefix bounds extended by n will skip over matches that appear in positions lower than nAn IntervalsSource that filters the intervals from another IntervalsSourceWraps anIntervalIteratorand passes through those intervals that match theIntervalFilter.accept()functionADocIdSetIteratorthat also allows iteration over matching intervals in a document.An extension of MatchesIterator that allows it to be treated as an IntervalIterator This is necessary to get access toIntervalIterator.gaps()andIntervalIterator.width()when constructing matchesA query that retrieves documents containing intervals returned from anIntervalsSourceStatic constructor functions for various different sources can be found in theIntervalsclass Scores for this query are computed as a function of the sloppy frequency of intervals appearing in a particular document.Constructor functions forIntervalsSourcetypes These sources implement minimum-interval algorithms taken from the paper Efficient Optimally Lazy Algorithms for Minimal-Interval Semantics By default, sources that are sensitive to internal gaps (e.g.A helper class forIntervalQuerythat provides anIntervalIteratorfor a given field and segment Static constructor functions for various different sources can be found in theIntervalsclassA source returning no matchesTracks a reference intervals source, and produces a pseudo-interval that appears either one position before or one position after each interval from the referenceGenerates an iterator that spans repeating instances of a sub-iterator, avoiding minimization.