On May 11, 2004, at 7:41 PM, Glen Stampoultzis wrote:

Is it possible to use float and date ranges in that case? Or maybe I should
just read the details in the manual and stop asking stupid questions. :-)

Terms in the index are *always* text. The DateField class in Lucene helps do conversions, but see the wiki for more info on date fields. I wouldn't recommend using it, personally, unless millisecond granularity is really desired.


For other types, if you need range queries, you need to make the textual representation be ordered lexicographically (i.e. pad the numbers with leading zeros so that all numbers have the same width) - again, some of this is on the wiki.

There really isn't anything in the "manual" about field types, that I know of, only brief mentions on the wiki and e-mail archives.

Erik



"Matt Quail" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Eric Jain wrote:
To ask a silly question:  What approach does Lucene use for
ranges and sorting?


A range such as '10-60' is expanded into a boolean query containing all
terms that are in the index and lie within the specified range, e.g. '10
or 11 or 20 or 59'.

Yes, using a range search requires loading all the (existant) terms between '10' and '60' and combining them into one big Boolean "or" query. There is a limit to how big such a query can get.

The performant alternative is to use a Filter. You lose the ability to
do boosting on that field, but it can handle ranges of any size.

=Matt




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to