lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r917547 - in /lucene/solr/trunk/src: java/org/apache/solr/search/QueryParsing.java test/org/apache/solr/search/QueryParsingTest.java
Date Mon, 01 Mar 2010 14:27:45 GMT
Author: koji
Date: Mon Mar  1 14:27:45 2010
New Revision: 917547

URL: http://svn.apache.org/viewvc?rev=917547&view=rev
Log:
SOLR-1297: fix for more deep function

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java
    lucene/solr/trunk/src/test/org/apache/solr/search/QueryParsingTest.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java?rev=917547&r1=917546&r2=917547&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java Mon Mar  1 14:27:45
2010
@@ -264,7 +264,7 @@
             needOrder = false;
           }
         }
-      } else if (chars[i] == '(' && functionDepth == 0) {
+      } else if (chars[i] == '(' && functionDepth >= 0) {
         buffer.append(chars[i]);
         functionDepth++;
       } else if (chars[i] == ')' && functionDepth > 0) {

Modified: lucene/solr/trunk/src/test/org/apache/solr/search/QueryParsingTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/search/QueryParsingTest.java?rev=917547&r1=917546&r2=917547&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/search/QueryParsingTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/search/QueryParsingTest.java Mon Mar  1 14:27:45
2010
@@ -100,6 +100,12 @@
     //Not thrilled about the fragility of string matching here, but...
     //the value sources get wrapped, so the out field is different than the input
     assertEquals(flds[0].getField(), "pow(float(weight),const(2.0))");
+    
+    //test functions (more deep)
+    sort = QueryParsing.parseSort("sum(product(r_f,sum(d_f,t_f,1)),a_f) asc", schema);
+    flds = sort.getSort();
+    assertEquals(flds[0].getType(), SortField.CUSTOM);
+    assertEquals(flds[0].getField(), "sum(product(float(r_f),sum(float(d_f),float(t_f),const(1.0))),float(a_f))");
 
     sort = QueryParsing.parseSort("pow(weight,                 2)         desc", schema);
     flds = sort.getSort();



Mime
View raw message