mkhludnev commented on a change in pull request #1034: SOLR-13863: payload 
query function now handles string encoded payload field 
(delimited_payloads_string)
URL: https://github.com/apache/lucene-solr/pull/1034#discussion_r360662836
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/search/ValueSourceParser.java
 ##########
 @@ -722,13 +722,29 @@ public ValueSource parse(FunctionQParser fp) throws 
SyntaxError {
 
         TInfo tinfo = parseTerm(fp); // would have made this parser a new 
separate class and registered it, but this handy method is private :/
 
-        ValueSource defaultValueSource;
-        if (fp.hasMoreArguments()) {
-          defaultValueSource = fp.parseValueSource();
-        } else {
-          defaultValueSource = new ConstValueSource(0.0f);
+        IndexSchema schema = fp.getReq().getCore().getLatestSchema();
+        final FieldType fieldType = schema.getFieldType(tinfo.field);
+
+        final String payloadEncoder = 
PayloadUtils.getPayloadEncoder(fieldType);
+        if (payloadEncoder.equals("identity")) {
+
+          ValueSource defaultValueSource = (fp.hasMoreArguments()) ? 
fp.parseValueSource() : new LiteralValueSource("");
+
+          if (fp.hasMoreArguments()) {
+              // functions are not supported with strings
+              throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, 
"Invalid payload function: " + fp.parseArg());
 
 Review comment:
   Please explain why it;s invalid in exception message. It seems like in/mas 
isn't supported so far.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to