You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Mark Miller <ma...@gmail.com> on 2009/04/28 03:28:25 UTC

RangeQuery and getTerm

RangeQuery is based on two terms rather than one, and currently returns 
null from getTerm.

This can lead to less than obvious null pointer exceptions. I'd almost 
prefer to throw UnsupportedOperationException.

However, returning null allows you to still use getTerm on 
MultiTermQuery and do a null check in the RangeQuery case. Not sure how 
valuable that really is though.

Thoughts?

-- 
- Mark

http://www.lucidimagination.com




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


Re: RangeQuery and getTerm

Posted by Mark Miller <ma...@gmail.com>.
Okay, I agree - best would be to lose the method that does not make 
sense for all multiterm queries.

I'll work on deprecating it and moving getTerm up to the sub queries 
that it makes sense for.

- Mark

Uwe Schindler wrote:
> During my implementations on trie range, I was always wondering, why
> MultiTermQuery has this method. It seems to be relict from the past. The
> term is only used in Fuzzy* (as far as I have seen).
>
> Why no deprecate getTerm() in MultiTermQuery, remove the field in
> MultiTermQuery and all related occurrences? The field and methods are then
> *not* deprecated and senseful implemented in Fuzzy*.
>
> In my opinion, the MultiTermQuery should only provide the functionality to
> handle FilteredTermEnums and everything else should be left to the
> implementor.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>   
>> -----Original Message-----
>> From: Mark Miller [mailto:markrmiller@gmail.com]
>> Sent: Tuesday, April 28, 2009 3:28 AM
>> To: java-dev@lucene.apache.org
>> Subject: RangeQuery and getTerm
>>
>> RangeQuery is based on two terms rather than one, and currently returns
>> null from getTerm.
>>
>> This can lead to less than obvious null pointer exceptions. I'd almost
>> prefer to throw UnsupportedOperationException.
>>
>> However, returning null allows you to still use getTerm on
>> MultiTermQuery and do a null check in the RangeQuery case. Not sure how
>> valuable that really is though.
>>
>> Thoughts?
>>
>> --
>> - Mark
>>
>> http://www.lucidimagination.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>     
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>   


-- 
- Mark

http://www.lucidimagination.com




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


Re: RangeQuery and getTerm

Posted by Michael McCandless <lu...@mikemccandless.com>.
On Tue, Apr 28, 2009 at 2:38 AM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Why not deprecate getTerm() in MultiTermQuery, remove the field in
> MultiTermQuery and all related occurrences? The field and methods are then
> *not* deprecated and senseful implemented in Fuzzy*.

+1

Mike

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


RE: RangeQuery and getTerm

Posted by Uwe Schindler <uw...@thetaphi.de>.
During my implementations on trie range, I was always wondering, why
MultiTermQuery has this method. It seems to be relict from the past. The
term is only used in Fuzzy* (as far as I have seen).

Why no deprecate getTerm() in MultiTermQuery, remove the field in
MultiTermQuery and all related occurrences? The field and methods are then
*not* deprecated and senseful implemented in Fuzzy*.

In my opinion, the MultiTermQuery should only provide the functionality to
handle FilteredTermEnums and everything else should be left to the
implementor.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Mark Miller [mailto:markrmiller@gmail.com]
> Sent: Tuesday, April 28, 2009 3:28 AM
> To: java-dev@lucene.apache.org
> Subject: RangeQuery and getTerm
> 
> RangeQuery is based on two terms rather than one, and currently returns
> null from getTerm.
> 
> This can lead to less than obvious null pointer exceptions. I'd almost
> prefer to throw UnsupportedOperationException.
> 
> However, returning null allows you to still use getTerm on
> MultiTermQuery and do a null check in the RangeQuery case. Not sure how
> valuable that really is though.
> 
> Thoughts?
> 
> --
> - Mark
> 
> http://www.lucidimagination.com
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org



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