lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trejkaz <>
Subject Re: Rewriting other query types into span queries and two questions about this
Date Mon, 08 Aug 2011 05:09:13 GMT
On Mon, Aug 8, 2011 at 10:00 AM, Trejkaz <> wrote:
>    within(5, 'my', and('cat', 'dog')) -> within(5, 'my', within(10, 'cat', 'dog')

To extend my example and maybe make it a bit more hellish, take this one:

    within(2, A, and(B, or(C, and(D, E))))

After rewriting both and() to SpanNearQuery, to avoid losing any
positive matches, I got to wondering if the span has to be 4 still, or
whether the value increases?

Winding back to talk about the intent of the query, what I would like to do:

    - Find the spans for A
    - Place some invisible markers 2 positions away from the spans for A
    - Within this area "Near A", perform the rest of the boolean span logic

One possible way to rewrite this complicated example might be:

    or( within(2, and( a, b, c )),
      within(2, and( a, b, d, e )) )

This then falls back to the same rewrite pattern as before, which
suggests that a slop of n*2 (in this case 4) is sufficient to ensure
that no hits are lost.

It also makes me wonder about a feature request for a new kind of span
query.  Perhaps it would be called SpanAllNearQuery, taking a span to
use as an anchor and a number of other spans which must also be near

It would be nice if there were a SpanAndQuery and nesting those with
SpanOrQuery in either order could do what you would expect when the
whole thing is inside a SpanNearQuery.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message