lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <morus.wal...@tanto.de>
Subject Re: Synonyms for AND/OR/NOT operators
Date Tue, 21 Dec 2004 11:40:11 GMT
Sanyi writes:
> Well, I guess I'd better recognize and replace the operator synonyms to their original
format
> before passing them to QueryParser. I don't feel comfortable tampering with Lucene's
source code.
> 
Apart from knowing how to compile lucene (including the javacc code
generation) you should only need to change

<DEFAULT> TOKEN : {
  <AND:       ("AND" | "&&") >
| <OR:        ("OR" | "||") >
| <NOT:       ("NOT" | "!") >

to
<DEFAULT> TOKEN : {
  <AND:       ("AND" | "<insert your version of and here>" | "&&") >
| <OR:        ("OR" | "<insert your version of or here>" | "||") >
| <NOT:       ("NOT" | "<insert your version of not here>" | "!") >

in jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj

Replacing the operators before query might be hard to do, if you want
to handle cases like »"a AND b" OR c«, which is a query for a 
phrase "a AND b" or the token c, correctly.

Morus



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