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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: QueryParser.parse() and Lucene1.4.1
Hi Polima, It seems to me that your query string is not correct ... (A AND -(B)) AND = + NOT = - In lucene AND and NOT opperators are mapped internal to +/-, (AND and NOT are supported only because they are comming from natural language) so ... A + - (B) makes no sense ... Sergiu Polina Litvak wrote: I have a question regarding QueryParser and lucene-1.4.1.jar: When using lucene-1.3-final.jar, a query of the form: Field:(A AND -(B)) was parsed into +Field:A -Field:B (using QueryParser.parse()). After making the switch to lucene-1.4.1.jar, the same query is being parsed into Field:A Field:- Field:B which is not the desired outcome. Does anyone know how to work around this new feature ? Thanks, Polina - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: QueryParser.parse() and Lucene1.4.1
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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: QueryParser.parse() and Lucene1.4.1
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) So is this behaviour a bug, or Lucene1.4 is not backwards compatible? Polina -Original Message- From: Daniel Naber [mailto:[EMAIL PROTECTED] Sent: September 15, 2004 5:07 PM To: Lucene Users List Subject: Re: QueryParser.parse() and Lucene1.4.1 On Wednesday 15 September 2004 21:58, Polina Litvak wrote: Does anyone know how to work around this new feature ? I can't remember any changes in this area, but I just tried with the current version from CVS and the output is the one which you want. Regards Daniel -- http://www.danielnaber.de - 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]
Re: QueryParser.parse() and Lucene1.4.1
On Thursday 16 September 2004 19:38, Polina Litvak wrote: I ran my code first with lucene-1.3-final.jar, getting the query Field:(A AND -(B)) parsed into +Field:A -Field:B This code: Query query = QueryParser.parse(Field:(AAA AND -(BBB)), field, new StandardAnalyzer()); System.out.println(query); Will print this with Lucene 1.4.1: +Field:aaa -Field:bbb It will not work with A instead of AAA because A is a stopword. In other words, I still cannot reproduce your problem. Regards Daniel -- http://www.danielnaber.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
QueryParser.parse() and Lucene1.4.1
I have a question regarding QueryParser and lucene-1.4.1.jar: When using lucene-1.3-final.jar, a query of the form: Field:(A AND -(B)) was parsed into +Field:A -Field:B (using QueryParser.parse()). After making the switch to lucene-1.4.1.jar, the same query is being parsed into Field:A Field:- Field:B which is not the desired outcome. Does anyone know how to work around this new feature ? Thanks, Polina
Re: QueryParser.parse() and Lucene1.4.1
On Wednesday 15 September 2004 21:58, Polina Litvak wrote: Does anyone know how to work around this new feature ? I can't remember any changes in this area, but I just tried with the current version from CVS and the output is the one which you want. Regards Daniel -- http://www.danielnaber.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]