lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r540839 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/queryParser/QueryParser.java src/java/org/apache/lucene/queryParser/QueryParser.jj src/test/org/apache/lucene/queryParser/TestQueryParser.java
Date Wed, 23 May 2007 04:54:39 GMT
Author: buschmi
Date: Tue May 22 21:54:38 2007
New Revision: 540839

URL: http://svn.apache.org/viewvc?view=rev&rev=540839
Log:
LUCENE-881: QueryParser.escape() now also escapes the characters '|' and '&'

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
    lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=540839&r1=540838&r2=540839
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Tue May 22 21:54:38 2007
@@ -128,6 +128,9 @@
 16. LUCENE-883: consecutive calls to Spellchecker.indexDictionary()
     won't insert terms twice anymore. (Daniel Naber)
 
+17. LUCENE-881: QueryParser.escape() now also escapes the characters
+    '|' and '&' which are part of the queryparser syntax. (Michael Busch)
+
 New features
 
  1. LUCENE-759: Added two n-gram-producing TokenFilters.

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java?view=diff&rev=540839&r1=540838&r2=540839
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java Tue May 22 21:54:38
2007
@@ -803,7 +803,7 @@
       // These characters are part of the query syntax and must be escaped
       if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':'
         || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c ==
'~'
-        || c == '*' || c == '?') {
+        || c == '*' || c == '?' || c == '|' || c == '&') {
         sb.append('\\');
       }
       sb.append(c);

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj?view=diff&rev=540839&r1=540838&r2=540839
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj Tue May 22 21:54:38
2007
@@ -827,7 +827,7 @@
       // These characters are part of the query syntax and must be escaped
       if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':'
         || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c ==
'~'
-        || c == '*' || c == '?') {
+        || c == '*' || c == '?' || c == '|' || c == '&') {
         sb.append('\\');
       }
       sb.append(c);

Modified: lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java?view=diff&rev=540839&r1=540838&r2=540839
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java Tue May
22 21:54:38 2007
@@ -616,6 +616,10 @@
     assertEscapedQueryEquals("[ a - TO a+ ]", null, "\\[ a \\- TO a\\+ \\]");
     assertEscapedQueryEquals("[ a : TO a~ ]", null, "\\[ a \\: TO a\\~ \\]");
     assertEscapedQueryEquals("[ a\\ TO a* ]", null, "\\[ a\\\\ TO a\\* \\]");
+    
+    // LUCENE-881
+    assertEscapedQueryEquals("|| abc ||", a, "\\|\\| abc \\|\\|");
+    assertEscapedQueryEquals("&& abc &&", a, "\\&\\& abc \\&\\&");
   }
   
   public void testTabNewlineCarriageReturn()



Mime
View raw message