0
votes

I already have some documents indexed using more NumericFields per document. Now I want to search the documents that have all fields from <-3,+3> interval e.g.:

query: n1=7,n2=10,n3=12 - and the search should return all documents that have numbers from intervals: n1=<4,10>,n2=<7,13>,n3=<9,15>.

Question: what analyzer do I need, how to write a query, what searcher to use?

It's an assignment, so I can't use any other tools that are built for searching in ranges, have to use Lucene.

Thanks

1

1 Answers

2
votes

Is does not require any analzer or searcher,
just need to ensure building the correct query like :-

Example 1: Or (meaning match either one of the conditions)

n1:(4 10) n2:(7 13) n3:(9 15)

Example 2: And (meaning all three parenthesis must matched)

+n1:(4 10) +n2:(7 13) +n3:(9 15)

Example 3: Range (your question sounds like a range search)

n1:[4 TO 10] n2:[7 TO 13] n3:[9 TO 15]

Example 4: And range

+n1:[4 TO 10] +n2:[7 TO 13] +n3:[9 TO 15]