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 00:00:40 GMT
On Mon, Aug 8, 2011 at 8:58 AM, Michael Sokolov <> wrote:
> 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 :) ?

Hmm... this is a good idea.  If it omits results which should have hit
then it won't be accepted, but with a bit of tweaking, it won't:

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

This one should match everything from the original intent of the
query.  It will still produce false positives, but not nearly as many
as the and(within, within) version I originally had.

(In searching for solutions on the net, I am finding a number of
interesting claims that using a slop of Integer.MAX_VALUE will somehow
simulate this sort of thing... but I am highly skeptical of such
claims and have a unit test which shows that it breaks as soon as you
put it inside a span-near...)


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

View raw message