lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Vasilev <ivasi...@sirma.bg>
Subject Re: NumericField exact match
Date Fri, 26 Feb 2010 20:33:35 GMT
Thanks for the answer Uwe,

Does it matter precision step when I use NumericRangeQuery for exact 
matches? I mean if I use the default precision step when indexing that 
fields it is guaranteed that:
1. With this query I will always hit the docs that contain "val" for the 
"field";
2. I will never hit docs with different that have diferent "val" for the 
"field";

Ivan


Uwe Schindler wrote:
> 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
>
>
> __________ NOD32 3990 (20090406) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   


---------------------------------------------------------------------
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