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