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_r360662950
########## File path: solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java ########## @@ -569,6 +570,57 @@ public void testPayloadFunction() { assertQ(req("fl","*,score","q", "{!func}payload(vals_dpf,A)", CommonParams.DEBUG, "true"), "//float[@name='score']='1.0'"); } + @Test + public void testStringPayloadFunction() { + clearIndex(); + + SolrInputDocument doc = new SolrInputDocument(); + doc.setField("id", "1"); + doc.setField("vals_dpss", new String[]{"A|USD", "C|EUR", "SORT|A"}); + assertU(adoc(doc)); + + doc = new SolrInputDocument(); + doc.setField("id", "2"); + doc.setField("vals_dpss", new String[]{"A|usd", "C|eur", "SORT|B"}); + assertU(adoc(doc)); + + doc = new SolrInputDocument(); + doc.setField("id", "3"); + doc.setField("vals_dpss", new String[]{"A|Usd", "C|Eur", "SORT|C"}); + assertU(adoc(doc)); + + assertU(commit()); + + assertQ(req("q", "id:1", "fl", "*,score,field_test:payload(vals_dpss,A)"), "//str[@name='field_test']='USD'"); + assertQ(req("q", "id:2", "fl", "*,score,field_test:payload(vals_dpss,C)"), "//str[@name='field_test']='eur'"); + assertQ(req("q", "*:*", + "rows", "1", + "sort", "payload(vals_dpss,C) asc", + "fl", "*,score,field_test:payload(vals_dpss,C)"), "//str[@name='field_test']='EUR'"); Review comment: I don't see how sort order is asserted. ---------------------------------------------------------------- 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