lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: NumericField exact match
Date Fri, 26 Feb 2010 19:47:43 GMT
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: uwe@thetaphi.de

> -----Original Message-----
> From: Ivan Vasilev [mailto:ivasilev@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



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


Mime
View raw message