Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8597

Allow filtering of Intervals by their internal gaps

    XMLWordPrintableJSON

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      We currently allow filtering of intervals by their total size, via the `Intervals.maxwidth` static method.  This works well enough, but there are several cases where you might want to restrict the gap between two intervals, but don't necessarily know the total width.  For example, if you want to know that an unordered pair `term1 term2` with no width restriction is less than two positions away from another term: there is no current way to construct an interval query that would return this.

      To enable this, I propose adding a `gaps()` method to IntervalIterator, which returns the number of internal gaps between the iterators constituent sub-iterators.  Terms and phrases, would return 0, and ordered/unordered combinations would return the number of positions separating their immediate children.  Note that this does not include the gaps within any of those children themselves.

        Attachments

        1. LUCENE-8597.patch
          25 kB
          Alan Woodward

          Activity

            People

            • Assignee:
              romseygeek Alan Woodward
              Reporter:
              romseygeek Alan Woodward
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: