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

Munendra S N commented on SOLR-14678:
-------------------------------------

[~hossman]
{code:java}
curl --globoff 
'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=color_s:RED&fl=id,docs,[value+v=777],[child]'
{code}
The above request returns the child docs. With the new way of nested 
documents(field labelled relationship), while fetching child documents through 
the child doctransformer, docs are added as field value.
Something like, parent.setField("docs", childdocs) in this case. While writing 
the response, writer check if the field is requested or not. Since, {{docs}} is 
not requested, it won't be returned in the response.

https://github.com/apache/lucene-solr/blob/03a03b34a468f8095c7f0b87ceeaf4ba0d4aeaec/solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformer.java#L193

https://github.com/apache/lucene-solr/blob/03a03b34a468f8095c7f0b87ceeaf4ba0d4aeaec/solr/core/src/java/org/apache/solr/response/JSONWriter.java#L92
----

Skimming through the code, it looks this behavior existed with new way of 
nested documents from beginning(I haven't verified this).  Probably, We need to 
document this limitation
With regards to adding support, maybe we could do something similar to how 
{{childDocuments}} are added in solrDocument but parsing the response could be 
tricky or add an additional check in responseWriter, something like {{val 
instanceof SolrDocument}} then write it to response stream whether or not field 
is requested(Need to check if this could break anything). 

> [child] DocTransformer doesn't work unless (request) fl inlcudes '*'
> --------------------------------------------------------------------
>
>                 Key: SOLR-14678
>                 URL: https://issues.apache.org/jira/browse/SOLR-14678
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Chris M. Hostetter
>            Priority: Major
>
> Discovered this while working on SOLR-14383, affects at least 8.6, not sure 
> how far back.
> Whatever the problem is, it seems specific to {{[child]}} transformer, 
> doesn't affect things like {{[value]}}
> Here's some quick example queries showing the discrepancy in behavior...
> {noformat}
> hossman@slate:~$ curl 
> 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=color_s:RED'
> {
>   
> "response":{"numFound":2,"start":0,"maxScore":0.31506687,"numFoundExact":true,"docs":[
>       {
>         "id":"P11!S21",
>         "color_s":"RED",
>         "price_i":42,
>         "_version_":1672933421950697472},
>       {
>         "id":"P22!S22",
>         "color_s":"RED",
>         "price_i":89,
>         "_version_":1672933422124761088}]
>   }}
> hossman@slate:~$ curl --globoff 
> 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=color_s:RED&fl=id,price_i,[value+v=777]'
> {
>   
> "response":{"numFound":2,"start":0,"maxScore":0.31506687,"numFoundExact":true,"docs":[
>       {
>         "id":"P11!S21",
>         "price_i":42,
>         "[value]":"777"},
>       {
>         "id":"P22!S22",
>         "price_i":89,
>         "[value]":"777"}]
>   }}
> hossman@slate:~$ curl --globoff 
> 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=color_s:RED&fl=id,price_i,[value+v=777],[child]'
> {
>   
> "response":{"numFound":2,"start":0,"maxScore":0.31506687,"numFoundExact":true,"docs":[
>       {
>         "id":"P11!S21",
>         "price_i":42,
>         "[value]":"777"},
>       {
>         "id":"P22!S22",
>         "price_i":89,
>         "[value]":"777"}]
>   }}
> hossman@slate:~$ curl --globoff 
> 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=color_s:RED&fl=*,[value+v=777],[child]'
> {
>   
> "response":{"numFound":2,"start":0,"maxScore":0.31506687,"numFoundExact":true,"docs":[
>       {
>         "id":"P11!S21",
>         "color_s":"RED",
>         "price_i":42,
>         "_version_":1672933421950697472,
>         "[value]":"777",
>         "docs":[
>           {
>             "id":"P11!D41",
>             "name_s":"Red Swingline Brochure",
>             "content_t":"...",
>             "_version_":1672933421950697472,
>             "[value]":"777"}]},
>       {
>         "id":"P22!S22",
>         "color_s":"RED",
>         "price_i":89,
>         "_version_":1672933422124761088,
>         "[value]":"777",
>         "docs":[
>           {
>             "id":"P21!D41",
>             "name_s":"Red Mont Blanc Brochure",
>             "content_t":"...",
>             "_version_":1672933422124761088,
>             "[value]":"777"}]}]
>   }}
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to