Say my index contains documents with a field called “ages”. Example entries for “ages” field:
- 25
- 24, 28
- 25, 31
How would I query this so that I get all the documents whose fields contain ages between 20 and 30? I’m using Zend Lucene.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
lmgtfy :-
Docs:- http://framework.zend.com/manual/en/zend.search.lucene.query-api.html#zend.search.lucene.queries.range
Both lucene and solr support multivalued.
For your case, you did not normalized the data very well.
Reassign the ages field as multivalued,
the range query is to match one of the value in multivalued.
That’s mean
If you need to match ALL value between 20 to 30,
You can use another field(s),
like :-
After that, you can change to search on
age_20_30:1.This is like telling lucene to work on the summary results