mirror of
https://github.com/apache/lucene.git
synced 2025-02-08 11:05:29 +00:00
SOLR-1297: fix for more deep function
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@917547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4aa3cad3ee
commit
6efeb6196f
@ -264,7 +264,7 @@ public class QueryParsing {
|
|||||||
needOrder = false;
|
needOrder = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (chars[i] == '(' && functionDepth == 0) {
|
} else if (chars[i] == '(' && functionDepth >= 0) {
|
||||||
buffer.append(chars[i]);
|
buffer.append(chars[i]);
|
||||||
functionDepth++;
|
functionDepth++;
|
||||||
} else if (chars[i] == ')' && functionDepth > 0) {
|
} else if (chars[i] == ')' && functionDepth > 0) {
|
||||||
|
@ -101,6 +101,12 @@ public class QueryParsingTest extends AbstractSolrTestCase {
|
|||||||
//the value sources get wrapped, so the out field is different than the input
|
//the value sources get wrapped, so the out field is different than the input
|
||||||
assertEquals(flds[0].getField(), "pow(float(weight),const(2.0))");
|
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);
|
sort = QueryParsing.parseSort("pow(weight, 2) desc", schema);
|
||||||
flds = sort.getSort();
|
flds = sort.getSort();
|
||||||
assertEquals(flds[0].getType(), SortField.CUSTOM);
|
assertEquals(flds[0].getType(), SortField.CUSTOM);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user