lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <>
Subject RE: Query syntax on Keyword field question
Date Wed, 24 Mar 2004 14:00:05 GMT
Hi Chad,

> But I assume this fix won't come out for some time.  Is there a way I can get this fix
> I'm up against a deadline and would very much like this functionality. 

Just get lucenes sources, change the line and recompile.
The difficult part is to get a copy of JavaCC 2 (3 won't do), but I think
this can be found in the archives.

> And to go one more step with the KeywordAnalyzer that I wrote, changing this method to
skip the escape:
>     protected boolean isTokenChar(char c)
>     {
>          if (c == '\\')
>          {
>             return false;
>          }
>          else
>          {
>             return true;
>          }
>       }
> The test then returns with a space:
>  healthecare.domain.lucenesearch.KeywordAnalyzer:
> query.ToString = +category:"HW -NCI_TOPICS" +space
> junit.framework.ComparisonFailure: HW-NCI_TOPICS kept as-is 
> Expected:+category:HW\-NCI_TOPICS +space
> Actual  :+category:"HW -NCI_TOPICS" +space   <----note space where escape was.

Sure. If \ isn't a token char, it end's the token.
So you will have to look for a different way of implementing the
analyzer. Shouldn't be that difficult since you have only one token.

Maybe it should be the job of the query parser to remove the escape character
(would make more sense to me at least) but that would be another change
of the query parser...


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message