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: Numeric Range Restrictions: Queries vs Filters
Date Tue, 23 Nov 2004 20:41:53 GMT
On Nov 23, 2004, at 2:16 PM, Chris Hostetter wrote:
> : I did a little code cleanup, Chris, renaming some RangeFilter 
> variables
> : and correcting typos in the Javadocs.  Let me know if everything 
> looks
> : ok.
>
> Wow ... that was fast.  Things look fine to me (typo's in javadocs are 
> my
> specialty)  but now I wish I'd included more tests

We can always add more tests.  Anytime.

> First: Is there any reason Matt Quail's "LongField" class hasn't been
> added to CVS (or has it and I'm just not seeing it?)

Laziness is the only reason, at least on my part.  I think adding it is 
a great thing.  I'll look into it.

> I haven't tested it extensively, but strikes me as being a crucial 
> utility
> for people who want to do any serious sorting or filtering of numeric
> values.

I debate (with myself) on whether add-ons that can be done with other 
code is worth adding to Lucene's core.  In this case the utility 
methods are so commonly needed that it makes sense.  But it could be 
argued also that there are are classes in Lucene that are not central 
to its operation.

> Although I would suggest a few minor tweaks:
>   a) Rename to something like NumberTools (to be consistent with the 
> new
>      DateTools and because...)

Agreed.

>   b) Add some one line convinience methods like intToString and
>      floatToString and doubleToString ala:
>          return longToString(Double.doubleToLongBits(d));

No objects to having convenience methods - though I need to look at 
what the LongField code is providing before commenting in detail.

> : And now with FilteredQuery you can have the best of both worlds :)
>
> See, this is what I'm not getting: what is the advantage of the second
> world? :) ... in what situations would using...
>
>    s.search(q1, new QueryFilter(new RangeQuery(t1,t2,true));
>
> ...be a better choice then...
>
>    s.search(q1, new 
> RangeFilter(t1.field(),t1.text(),t2.text(),true,true);

Note that I said FilteredQuery, not QueryFilter.

Certainly RangeFilter is cleaner than using a QueryFilter(RangeFilter) 
combination - that's why we added it.  :)

	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