lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Baker <de...@idexx.com>
Subject Re: range query problems
Date Fri, 17 Sep 2004 19:35:07 GMT

Ah, but if I escape the "0" in the term constructor:

     Term term2 = new Term("adzer", "\\0");

It works. And then it works for a dash as well. Seems that to pass a 
search string to a queryParser, the "0" has to be escaped doubly:

    searchString = "adzer: [# TO \\\\0]";

Just escaping with a double backslash does not work.

I still wonder though, if that is the desired behavior. It does not say 
on the page on the Lucene web site, that either "0" or "-" are special 
characters that need to be escaped.

Thanks for your time and for pointing me in the right direction.

Derek

Derek Baker wrote:

> Thanks for your reply.
>
> If I do it manually:
>
>    Term term1 = new Term("adzer", "#");
>    Term term2 = new Term("adzer", "0");
>    Query myQuery = new RangeQuery(term1, term2, true);
>    hits = searcher.search(myQuery);
>
> I still get nothing. If I make the first term in the new RangeQuery 
> call null:
>
>    Query myQuery = new RangeQuery(null, term2, true);
>
> I get nothing. If, however I make the second term in the new 
> RangeQuery call null:
>
>    Query myQuery = new RangeQuery(term1, null, true);
>
> I get the results I expect.
>
> Seems very strange.
>
> Derek
>
> Daniel Naber wrote:
>
>> On Friday 17 September 2004 19:37, Derek Baker wrote:
>>
>>  
>>
>>> However, if I create a range query that I would expect to find that
>>> value, I get nothing. The range query string is: "adzer:[# TO 0]" 
>>> (minus
>>> the quotes). As far as I can tell, this query string should find any
>>> value in the adzer fields that starts with a "-".
>>>   
>>
>>
>> Did you try building that query manually? Maybe even starting from 
>> null instead of #.
>>
>> Regards
>> Daniel
>>
>>  
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
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