Ops.. I just re-read the email.
I just need to query based on the precise id (exactly the unique int id).
You mean I can just to a "entryId.ToString()"? instead of using:
NumericUtils.IntToPrefixCoded(int val)

Thx
Simo


On Tue, Jan 12, 2010 at 6:49 PM, Michael Garski <[email protected]>wrote:

> It depends on your use case... if you only need to query for single
> items such as the unique integer id in a field then a standard field can
> be used.  If you need to query for numeric ranges, then a numeric field
> is the best choice due to performance.
>
> If you need to do both, numeric fields are the way to go but there is an
> extra step to query for items with a specific value.  You'll need to use
> the Lucene.Net.Utils.NumericUtils methods to convert the number to the
> prefix coded value in the index that is then used as the string value of
> the search.
>
> NumericUtils.IntToPrefixCoded(int val)
> NumericUtils.LongToPrefixCoded(long val)
> NumericUtils.FloatToPrefixCoded(float val)
> NumericUtils.DoubleToPrefixCoded(double val)
>
> Michael
>
>
>
> -----Original Message-----
> From: Simone Chiaretta [mailto:[email protected]]
> Sent: Tuesday, January 12, 2010 7:38 AM
> To: lucene-net-user
> Subject: How to search for a specific number on Lucene 2.9.1
>
> Hello,
> I see that when indexing an integer, when moving from Lucene 2.3 to
> 2.9.1 I
> get a obsolete warning for the NumericTools.
> I changed it to a NumericField but now how do I query it for an exact
> number?
> Do I use the NumericRangeQuery with min and max set to the same number?
> or
> is there a better way to do exact queries?
> Simone
>
> --
> Simone Chiaretta
> Microsoft MVP ASP.NET - ASPInsider
> Blog: http://codeclimber.net.nz
> RSS: http://feeds2.feedburner.com/codeclimber
> twitter: @simonech
>
> Any sufficiently advanced technology is indistinguishable from magic
> "Life is short, play hard"
>
>


-- 
Simone Chiaretta
Microsoft MVP ASP.NET - ASPInsider
Blog: http://codeclimber.net.nz
RSS: http://feeds2.feedburner.com/codeclimber
twitter: @simonech

Any sufficiently advanced technology is indistinguishable from magic
"Life is short, play hard"

Reply via email to