lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Storing numbers
Date Sun, 07 Mar 2004 14:20:53 GMT
On Mar 7, 2004, at 6:27 AM, lucene@nitwit.de wrote:
> On Fri, 5 Mar 2004 19:18:04 -0500, Erik Hatcher 
> <erik@ehatchersolutions.com>
> wrote:
>
>> Thanks for the idea for a good example for the upcoming Lucene in 
>> Action
>> book... it's been added!
>
> Thanks for mentioning me in the book ;)

Well, I actually already had a comment in the book about why you'd 
override getRangeQuery, and it said this:

   * handle number ranges by padding to match how numbers were indexed

You did give me the incentive to flesh this out into an example.

I also created a variant of this to parse range queries like this 
field:[1/1/04 TO 12/31/04] into YYYYMMDD syntax so it becomes 
field:[20040101 TO 20041231].  This is very handy when dealing with 
dates in a typically more sensible YYYYMMDD format and allowing users 
to deal with them naturally also.

> What about boolean fields? It's certainly not a good idea to use 
> "true" or
> "false" strings...

What about them?  It all depends on how you want users to be able to 
query based on that flag.  Do you want them to say field:true?  
field:on?  field:yes?  How you translate things in QueryParser is up to 
you - and this may of course have some impact on how you index.  You 
could use "0" and "1" instead, and do the translation in a QueryParser 
subclass if you like.

> BTW, isn't it slow to treat everything as strings?

Ummm, yeah.... Lucene is real slow!  :)

You tell us.... is it slow with your data and environment?  If so, give 
us some more details on the scenario.

	Erik


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


Mime
View raw message