[Xapian-discuss] How to choose the proximity between search words

James Aylett james-xapian at tartarus.org
Wed Dec 7 16:07:18 GMT 2011


On 7 Dec 2011, at 14:14, Nat wrote:

> I'd like to know how we can choose the distance between two words that we search
> in a text. I know there is an "op_near" operator but I don't know how I can
> specified that the number of words between the two specified words should not
> exceed 10 or 20 or x words.


Hey, Nat. For OP_NEAR (and OP_PHRASE), the "parameter" to the Xapian::Query constructor gives a "window" which will do what you want. The getting started guide has a little on these <http://getting-started-with-xapian.readthedocs.org/en/latest/concepts/search/queries.html#near-and-phrase>, although probably not nearly enough. I don't think it has practical examples of using them, but in the meantime the API docs have some details:

<http://xapian.org/docs/apidoc/html/classXapian_1_1Query.html#7e7b6b8ad0c915c2364578dfaaf6100b7a78c8353d5d06d3a38c1899ae762b21>

Hope this helps!

J

-- 
 James Aylett
 talktorex.co.uk - xapian.org - devfort.com




More information about the Xapian-discuss mailing list