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))) I also notices that a NEAR without the range came back with a NEAR 11 in the query. Is that by design? Thanks, Jim.
Ron Kass wrote:> Hi > > If my memory serves me correctly, near without a range sets the range > to the number of terms in the query. > > What was the query you tried without the range? > > > As for the 4/5 issue, maybe this is by design... NEAR/4 meaning 4 > words in the middle, which is the same as 5 words difference.... > offered(@1) word(@2) word(@3) word(@4) word(@5) case(@6)... as you can > see offered and case have 4 words between them.. and therefore their > positions are 1 and 6 (5 apart). Maybe thats how it is designed.. > > Haven't tried 'near' myself yet. > > > Ron > > > 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))) >> >> I also notices that a NEAR without the range came back with a NEAR 11 >> in the query. >> >> Is that by design? >> >> Thanks, >> Jim. >> >> _______________________________________________ >> Xapian-discuss mailing list >> Xapian-discuss@lists.xapian.org >> http://lists.xapian.org/mailman/listinfo/xapian-discuss >I didn't do a query without the range. I was testing ranges and just happened to notice the phenomenon Jim.
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