It's very easy: NumericRangeQuery.nexXxxRange(field, val, val, true, true) - 
val is the exact match. This is not slower as this automatically rewrites to a 
non-scored TermQuery. If you already changed QueryParser, you can also override 
the method for exactMatches (newTermQuery).

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de

> -----Original Message-----
> From: Ivan Vasilev [mailto:ivasi...@sirma.bg]
> Sent: Friday, February 26, 2010 8:21 PM
> To: LUCENE MAIL LIST
> Subject: NumericField exact match
> 
> Hi Guys,
> 
> Is it possible to make exact searches on fields that are of type
> NumericField and if yes how?
> In the LIA book part 2 I found only information about Range searches on
> such fields and how to Sort them.
> 
> Example - I have field "size" that can take integers as values.
> I want to get docs that are with "size:100".
> For the regular fields "size:100" is OK to pass to Parser but with
> NumericField it does not work.
> The only approach to support such fields that I can see is - to have
> parallel casual Field (example "size2") and to index the same data
> there.
> And then when user wants exact search on "size" I to perform
> "size2:100".
> 
> Is this the most appropriate way for my case on your opinion?
> 
> Thanks,
> Ivan
> 
> 
> 
> ---------------------------------------------------------------------
> 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