[Xapian-discuss] NEAR/N is returning a different query

Olly Betts olly at survex.com
Sun Oct 28 01:11:32 BST 2007


On Sat, Oct 27, 2007 at 10:42:17AM -0400, Jim wrote:
> I did a query such as "offered NEAR/4 case" but the query that was 
> returned is:
> 
> Xapian::Query((offered:(pos=1) NEAR 5 case:(pos=2)))

The number in Query::get_description() for NEAR or PHRASE is the
"window" size.  So NEAR 5 means that the terms need to occur in a range
of 5 adjacent term positions.

But the number is NEAR/4 is "within 4 words of".  So that's 4 term
positions from the first term, plus one for the position that the
first term is in.

> I also notices that a NEAR without the range came back with a NEAR 11 in 
> the query.

The default for NEAR is "within 10 words of".  Somewhat arbitrary, but I
looked around at the other engines which implemented NEAR at the time
and 10 seemed standard.

Cheers,
    Olly



More information about the Xapian-discuss mailing list