lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <>
Subject Re: Rewriting other query types into span queries and two questions about this
Date Sun, 07 Aug 2011 22:58:49 GMT
On 8/4/2011 9:06 PM, Trejkaz wrote:...
> For AND (and for any "default boolean" queries which aren't equivalent
> to OR) queries, I have problems.  For instance, you can't do this:
>      within(5, 'my', and('cat', 'dog')) ->  and( within(5, 'my', 'cat'),
> within(5, 'my', 'dog') )
> The problem is that this changes the semantics - the original query
> implies that the same "my" span is used when matching the other two,
> whereas the rewritten form allows it to be any "my" in the document.
> This problem doesn't exist with OR queries because it doesn't have to
> match both terms.
> Q2: Is there some way to "pin this down" such that the "my" matched by
> each is the same position?
Can you do something approximately equivalent like:

within(5, 'my', and('cat', 'dog')) ->
within(5, 'my', within(5, 'cat', 'dog') )

Might not be exactly the same in terms of distances (eg "cat x x x my x 
x x dog") might match the first and not the second... and "my x x x cat 
x x x dog" vice versa, but given that these are "sloppy" queries - maybe 
that's good enough :) ?

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

View raw message