You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2018/03/15 23:40:00 UTC

[jira] [Commented] (SOLR-12108) raw transformers ([json] and [xml]) drop the field value if wt is not a match and documentCache is not enabled

    [ https://issues.apache.org/jira/browse/SOLR-12108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401265#comment-16401265 ] 

Hoss Man commented on SOLR-12108:
---------------------------------

The patch in SOLR-11891 to make DocStreamer more efficient exposes this bug in pre-existing tests, and includes the necessary fix

> raw transformers ([json] and [xml]) drop the field value if wt is not a match and documentCache is not enabled
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-12108
>                 URL: https://issues.apache.org/jira/browse/SOLR-12108
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>            Priority: Major
>
> discovered this while working on SOLR-11891...
> The {{RawValueTransformerFactory}} class is suppose to treat the field value as a normal string in situations where an instance is limited by the {{wt}} param (which it is automatically for the default {{[json]}} and {{[xml]}} transformers.
> This is currently implemented by {{RawValueTransformerFactory.create()}} assuming it can just return "null" if the ResponseWriter in use doesn't match - but because of how this transformer abuses the "key" to implicitly indicate the field to be returned (ie: {{my_json_fieldName:[json]}}, it means that nothing about the resulting {{ReturnFields}} datastructure indicates that the field ({{my_json_fieldName}}) should be returned at all.
> Because of the existing sloppy code in SOLR-11891, that means this bug in ChildDocumentTransformer only impacts current users if the documentCache is disabled
> ----
> Example steps to reproduce w/techproducts config assuming {{solrconfig.xml}} is edited to disable documentCache...
> {noformat}
> $ curl 'http://localhost:8983/solr/techproducts/update?commit=true' -H 'Content-Type: application/json' --data-binary '[
>   {
>     "id": "1",
>     "raw_s":"{\"raw\":\"json\"}" } ]'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":39}}
> $ curl 'http://localhost:8983/solr/techproducts/query?wt=json&q=id:1&fl=raw_s'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":2,
>     "params":{
>       "q":"id:1",
>       "fl":"raw_s",
>       "wt":"json"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "raw_s":"{\"raw\":\"json\"}"}]
>   }}
> $ curl 'http://localhost:8983/solr/techproducts/query?wt=json&q=id:1&fl=raw_s:%5Bjson%5D'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":0,
>     "params":{
>       "q":"id:1",
>       "fl":"raw_s:[json]",
>       "wt":"json"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "raw_s":{"raw":"json"}}]
>   }}
> $ curl 'http://localhost:8983/solr/techproducts/query?wt=xml&q=id:1&fl=raw_s:%5Bjson%5D'
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
> <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">0</int>
>   <lst name="params">
>     <str name="q">id:1</str>
>     <str name="fl">raw_s:[json]</str>
>     <str name="wt">xml</str>
>   </lst>
> </lst>
> <result name="response" numFound="1" start="0">
>   <doc></doc>
> </result>
> </response>
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org