lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Polina Litvak" <plit...@casebank.com>
Subject RE: QueryParser.parse() and Lucene1.4.1
Date Fri, 17 Sep 2004 13:29:42 GMT
I found the source of error:

Turns out that given a query of the form 'Field:(A AND-(B))' (note the
no space between 'AND' and '-'), lucene-1.3 would output +Field:a
-Field:b, while lucene-1.4 would output Field:a Field:- Field:b


Thanks for all the help and the suggestions.

Polina



-----Original Message-----
From: Morus Walter [mailto:morus.walter@tanto.de] 
Sent: September 17, 2004 2:31 AM
To: Lucene Users List
Subject: RE: QueryParser.parse() and Lucene1.4.1

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
(http://cvs.apache.org/viewcvs.cgi/*
> 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:
>     http://issues.apache.org/bugzilla/show_bug.cgi?id=27491
>     (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.

Morus

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