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.
Say my index contains documents with a field called "ages". Example entries for "ages" field:
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.
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