Hi,

Continuing your example, you could do the following:

Document:

range1_from:1
range1_to:3
range2_from:12
range2_to:20
range3_from:13290
range3_to:16509
... other fields...


Query (for "2"):

(+range1_from:[* TO 2] +range1_to:[2 TO *]) OR
 (+range2_from:[* TO 2] +range2_to:[2 TO *]) OR
 (+range3_from:[* TO 2] +range3_to:[2 TO *])

I hope I got the query right, haven't tested it. But you should get
the general idea.

m.

On Thu, Jun 5, 2014 at 3:30 AM, Paul Tyson <phty...@sbcglobal.net> wrote:
> I'm new to Lucene and search technology. I've read just enough to be
> confused and dangerous, so please bear with me.
>
> My documents have sets of integer ranges, like 1-3,
> 12-20,....13290-16509, ....
>
> The total enumeration of ranges across all documents will be tens of
> thousands. Most documents will have only a few ranges, but some will
> have dozens or hundreds.
>
> I need to search for documents with a range that includes a given
> number. So in the above example, the document would match "2" or
> "15001", but not "4" or "11".
>
> Is this an appropriate use case for Lucene, and if so can someone sketch
> out a solution so I can connect the dots? Or is there example code, or
> documentation for this sort of thing? I've studied dynamic range facets,
> but those don't seem right because I have all the ranges at index time.
>
> Thanks,
> --Paul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to