I'm using Lucene, and I'm trying to find a way to index and retrieve documents that have a ranged property.
For example I have:
Document 1: Price:[30 TO 50]
Document 2: Price:[45 TO 60]
Document 3: Price:[60 TO 70]
And I would like to search for all the documents whose ranges intersect a specific interval, in the above example, if I search for Price in [55 TO 65]
I should get Document 2
and Document 3
as results.
I don't think NumericRangeQueries alone would do the trick, I need to work on the index with something similar to R-trees, but are they implemented in Lucene? Also, I suppose that what I need should be a subclass of MultiTermQuery, because the query Price in [55 TO 65]
has two boundaries, but I don't see anything suitable among MultiTermQuery's subclasses.
Any help is appreciated, thanks,
Silvio
P.S. I'm using Lucene 2.9.0, but I can update to the latest release if needed.