For example, I have some documents described by fields: id
, date
and price
.
First document: id=1
, date='from 10.01.2014 to 20.01.2014'
, price='120'
Second document: id=2
, date='19.01.2014'
and price='from 100 to 140'
My program receives key/value parameters and should find the most suitable documents. So, for example, with this parameters date=19.01.2014
and price='120'
program should find both documents. With date=20.01.2014
, price=120'
only the first document. With date='19.01.2014
, price=140'
only the second one.
How can I do it with Lucene in Java? I saw examples where I'm typing query like 'give me docs where date is from .. to ..', and Lucene gives me docs in this range. Instead of this I want to specify range for my document and not for query.