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

Support for a "SpanAndQuery" / "SpanAllNearQuery"

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I would like to parse queries like this:

      a WITHIN 5 WORDS OF (b AND c)
      

      This would match cases where both a b span and a c span are within 5 of the same a span.

      The existing span query classes do not appear to be capable of doing this no matter how they are combined, although replacing the AND with "WITHIN 10 OF" (general rule is to double the first number) at least ensures that no hits are lost (it just returns too many.)

      I'm not sure how the class would work, but it might be like this:

        Query q = new SpanAllNearQuery(a, new SpanQuery[] { b, c }, 5, false);
      

      The difference from SpanNearQuery is that SpanNearQuery considers the entire collection of terms as a single set to be found near each other, whereas this query would consider each of the terms in the array relative to the first.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              trejkaz Trejkaz
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: