-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Searching on numeric fields
PostPosted: Wed Aug 10, 2011 10:06 am 
Beginner
Beginner

Joined: Mon Apr 11, 2011 7:56 am
Posts: 38
Hi again,

Is it true that I need to use range queries (by using NumericFieldUtils for example) to be able to search on numeric fields?
The documentation says nothing about it and, if I remember correctly, I was able to search on numeric field by using an ordinary Lucene query parser.
However, I don't get it to work at the moment, so maybe it never worked without using a range query?


Top
 Profile  
 
 Post subject: Re: Searching on numeric fields
PostPosted: Wed Aug 10, 2011 10:15 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Elmer,
no NumericFields are a feature of latest Lucene versions: if you use them you can have some benefits, but they are not mandatory you can always use the old-style numeric encoding.

Remember that when you don't use NumericFields, you will likely want to apply some padding (leading zeros), and you will need to apply the same padding when searching. Finally, when using the Lucene Query Parser it will apply an analyzer on your input text, that might not be desirable! I'd stick with the programmatic approach do define the query.

See also the various PaddedIntegerBridge examples in the documentation.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.