[Xapian-devel] Does OP_NEAR works with stemming?

Olly Betts olly at survex.com
Tue May 31 04:14:32 BST 2011


On Sat, May 28, 2011 at 03:59:06AM +0800, Shen Li wrote:
> I used the OP_NEAR operator for queryparser, and when I searched for
> "apple store" from my own collection, the query is parsed as
> "Zappl:(pos=1) NEAR 11 Zstore:(pos=2)" but retrieved nothing. However,
> if I type in "Apple Store", the query is parsed as
> Xapian::Query((apple:(pos=1) NEAR 11 store:(pos=2))) and some results
> are showed. I'm not sure whether this has something to do with the
> stemming, and what I used is stem_some. Any clue is helpful, thank
> you!

I think you must be talking about using OP_NEAR as the default_op?

Yes, the issue seems to be stemming - the Z-prefix terms are stemmed
forms, and aren't indexed with positional information, so won't work
with OP_NEAR.  So if default_op is OP_NEAR or OP_PHRASE, we should be
forcing these subqueries to be unstemmed forms.

Not sure how easy that will be to fix.  For now, I'd suggest you just
set stem_none if you want to use default_op set to OP_PHRASE or OP_NEAR.

Cheers,
    Olly



More information about the Xapian-devel mailing list