lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <>
Subject RE: QueryParser.parse() and Lucene1.4.1
Date Fri, 17 Sep 2004 06:31:27 GMT
Polina Litvak writes:
> Hi Daniel,
> I just downloaded the latest version of Lucene and tried the whole thing
> again: I ran my code first with lucene-1.3-final.jar, getting the query
> Field:(A AND -(B)) parsed into +Field:A -Field:B, and then I ran exactly
> the same code with lucene-1.4.1.jar and got the output parsed into
> Field:A Field:- Field:B.
> I also read Lucene's documentation (*
> checkout*/jakarta-lucene/CHANGES.txt?rev=1.85), and it does mention a
> change to the "+" and "-" operators:
>     13. Changed QueryParser.jj to allow '-' and '+' within tokens:
>     (Morus Walter via Otis)
This change is unlikely to introduce the behaviour you describe, since
it affects '-' within words only, not at start.
So there is a change for a-b between 1.3 and 1.4
1.3 gives a -b
1.4 gives "a b" or one token a-b (depending on the analyzer) as it treats
the - as part of a word.

> So is this behaviour a bug, or Lucene1.4 is not backwards compatible?
Your behaviour cannot be seen from the test code (as Daniel already said):

java -cp lucene-1.3-final/lucene-1.3-final.jar  org.apache.lucene.queryParser.QueryParser
'Field:(A AND -(B))'
+Field:a -Field:b

java -cp lucene-1.4-final/lucene-1.4-final.jar org.apache.lucene.queryParser.QueryParser 'Field:(A
AND -(B))'
+Field:a -Field:b

java -cp lucene-1.4.1/lucene-1.4.1.jar org.apache.lucene.queryParser.QueryParser 'Field:(A
AND -(B))'
+Field:a -Field:b

So either you have a different query or something in your code is responsable
for the problem.


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

View raw message