Nat
2011-Dec-07 14:14 UTC
[Xapian-discuss] How to choose the proximity between search words
Hi, 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. I'm really sorry for my terrible English, I hope I'm understandable!
James Aylett
2011-Dec-07 16:07 UTC
[Xapian-discuss] How to choose the proximity between search words
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
Nat
2011-Dec-22 14:36 UTC
[Xapian-discuss] How to choose the proximity between search words
Hi! So thanks to James and OP_NEAR operator, I can search for terms within 10 words of each other. What I'd like is to choose the number of words : 10, 20, 50... Is that possible? Thanks in advance, Nat