mirror of https://github.com/apache/lucene.git
SOLR-3522: fixed parsing of the 'literal()' function
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1351460 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d0d55b0bf
commit
f6bd05ca2f
|
@ -509,6 +509,8 @@ Bug Fixes
|
|||
* SOLR-3541: add missing solrj dependencies to binary packages.
|
||||
(Thijs Vonk via siren)
|
||||
|
||||
* SOLR-3522: fixed parsing of the 'literal()' function (hossman)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
|||
addParser("literal", new ValueSourceParser() {
|
||||
@Override
|
||||
public ValueSource parse(FunctionQParser fp) throws ParseException {
|
||||
return new LiteralValueSource(fp.getString());
|
||||
return new LiteralValueSource(fp.parseArg());
|
||||
}
|
||||
});
|
||||
addParser("rord", new ValueSourceParser() {
|
||||
|
|
|
@ -231,4 +231,26 @@ public class QueryParsingTest extends SolrTestCaseJ4 {
|
|||
req.close();
|
||||
}
|
||||
|
||||
public void testLiteralFunction() throws Exception {
|
||||
|
||||
final String NAME = FunctionQParserPlugin.NAME;
|
||||
|
||||
SolrQueryRequest req = req("variable", "foobar");
|
||||
|
||||
assertNotNull(QParser.getParser
|
||||
("literal('a value')",
|
||||
NAME, req).getQuery());
|
||||
assertNotNull(QParser.getParser
|
||||
("literal('a value')",
|
||||
NAME, req).getQuery());
|
||||
assertNotNull(QParser.getParser
|
||||
("literal(\"a value\")",
|
||||
NAME, req).getQuery());
|
||||
assertNotNull(QParser.getParser
|
||||
("literal($variable)",
|
||||
NAME, req).getQuery());
|
||||
assertNotNull(QParser.getParser
|
||||
("strdist(\"a value\",literal('a value'),edit)",
|
||||
NAME, req).getQuery());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue