lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r580584 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/queryParser/QueryParser.jj src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java src/test/org/apache/lucene/queryParser/TestQueryParser.java
Date Sat, 29 Sep 2007 14:11:05 GMT
Author: yonik
Date: Sat Sep 29 07:10:56 2007
New Revision: 580584

URL: http://svn.apache.org/viewvc?rev=580584&view=rev
Log:
qp accept empty string: LUCENE-1006

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
    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?rev=580584&r1=580583&r2=580584&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Sep 29 07:10:56 2007
@@ -1,4 +1,4 @@
-Lucene Change Log
+Lucene Change Log
 
 $Id$
 
@@ -109,6 +109,9 @@
     vector fields is added after documents with term vector fields.
     This bug was introduced with LUCENE-843.  (Grant Ingersoll via
     Mike McCandless)
+
+16. LUCENE-1006: Fixed QueryParser to accept a "" field value (zero
+    length quoted string.)  (yonik)
 
 New features
 

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?rev=580584&r1=580583&r2=580584&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj Sat Sep 29 07:10:56
2007
@@ -888,7 +888,7 @@
 | <COLON:     ":" >
 | <STAR:      "*" >
 | <CARAT:     "^" > : Boost
-| <QUOTED:     "\"" (~["\""] | "\\\"")+ "\"">
+| <QUOTED:     "\"" (~["\""] | "\\\"")* "\"">
 | <TERM:      <_TERM_START_CHAR> (<_TERM_CHAR>)*  >
 | <FUZZY_SLOP:     "~" ( (<_NUM_CHAR>)+ ( "." (<_NUM_CHAR>)+ )? )? >
 | <PREFIXTERM:  ("*") | ( <_TERM_START_CHAR> (<_TERM_CHAR>)* "*" ) >

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java?rev=580584&r1=580583&r2=580584&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
(original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
Sat Sep 29 07:10:56 2007
@@ -142,7 +142,7 @@
                         kind = 6;
                   }
                   else if (curChar == 34)
-                     jjCheckNAddTwoStates(15, 17);
+                     jjCheckNAddStates(0, 2);
                   else if (curChar == 33)
                   {
                      if (kind > 9)
@@ -152,7 +152,7 @@
                   {
                      if (kind > 18)
                         kind = 18;
-                     jjCheckNAddStates(0, 4);
+                     jjCheckNAddStates(3, 7);
                   }
                   else if (curChar == 42)
                   {
@@ -175,16 +175,13 @@
                      kind = 9;
                   break;
                case 14:
+               case 16:
                   if (curChar == 34)
-                     jjCheckNAddTwoStates(15, 17);
+                     jjCheckNAddStates(0, 2);
                   break;
                case 15:
                   if ((0xfffffffbffffffffL & l) != 0L)
-                     jjCheckNAddStates(5, 7);
-                  break;
-               case 16:
-                  if (curChar == 34)
-                     jjCheckNAddStates(5, 7);
+                     jjCheckNAddStates(0, 2);
                   break;
                case 18:
                   if (curChar == 34 && kind > 17)
@@ -229,7 +226,7 @@
                      break;
                   if (kind > 18)
                      kind = 18;
-                  jjCheckNAddStates(0, 4);
+                  jjCheckNAddStates(3, 7);
                   break;
                case 29:
                   if ((0x7bfff8f8ffffd9ffL & l) == 0L)
@@ -276,7 +273,7 @@
                   {
                      if (kind > 18)
                         kind = 18;
-                     jjCheckNAddStates(0, 4);
+                     jjCheckNAddStates(3, 7);
                   }
                   else if (curChar == 92)
                      jjCheckNAddStates(13, 15);
@@ -342,7 +339,7 @@
                      jjstateSet[jjnewStateCnt++] = 11;
                   break;
                case 15:
-                  jjAddStates(5, 7);
+                  jjAddStates(0, 2);
                   break;
                case 17:
                   if (curChar == 92)
@@ -383,7 +380,7 @@
                      break;
                   if (kind > 18)
                      kind = 18;
-                  jjCheckNAddStates(0, 4);
+                  jjCheckNAddStates(3, 7);
                   break;
                case 29:
                   if ((0x97ffffff87ffffffL & l) == 0L)
@@ -451,12 +448,12 @@
                   {
                      if (kind > 18)
                         kind = 18;
-                     jjCheckNAddStates(0, 4);
+                     jjCheckNAddStates(3, 7);
                   }
                   break;
                case 15:
                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
-                     jjAddStates(5, 7);
+                     jjAddStates(0, 2);
                   break;
                case 24:
                   if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
@@ -470,7 +467,7 @@
                      break;
                   if (kind > 18)
                      kind = 18;
-                  jjCheckNAddStates(0, 4);
+                  jjCheckNAddStates(3, 7);
                   break;
                case 29:
                case 31:
@@ -955,7 +952,7 @@
    }
 }
 static final int[] jjnextStates = {
-   29, 32, 23, 33, 30, 15, 17, 18, 20, 21, 32, 23, 33, 31, 34, 27, 
+   15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, 
    2, 4, 5, 0, 1, 
 };
 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)

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?rev=580584&r1=580583&r2=580584&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java Sat Sep
29 07:10:56 2007
@@ -18,13 +18,8 @@
  */
 
 import junit.framework.TestCase;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.LowerCaseTokenizer;
-import org.apache.lucene.analysis.SimpleAnalyzer;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.Token;
-import org.apache.lucene.analysis.TokenFilter;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.DateField;
 import org.apache.lucene.document.DateTools;
@@ -199,6 +194,9 @@
     assertQueryEquals("term term term", null, "term term term");
     assertQueryEquals("türm term term", new WhitespaceAnalyzer(), "türm term term");
     assertQueryEquals("ümlaut", new WhitespaceAnalyzer(), "ümlaut");
+
+    assertQueryEquals("\"\"", new KeywordAnalyzer(), "");
+    assertQueryEquals("foo:\"\"", new KeywordAnalyzer(), "foo:");
 
     assertQueryEquals("a AND b", null, "+a +b");
     assertQueryEquals("(a AND b)", null, "+a +b");



Mime
View raw message