[
https://issues.apache.org/jira/browse/SOLR-14678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17163815#comment-17163815
]
Chris M. Hostetter commented on SOLR-14678:
-------------------------------------------
Hmmm, yes ... i see.
Really what this comes down to is that the ChildDocTransformer doesn't really
work like other transformers, in that it adds things to the doc using field
name(s) that don't match it's assigned "name" – so the implicit assumptions of
ReturnFields don't hold up.
This also means that the "field renaming" syntax doesn't work with the child
transformer either, ie:
{{id,fake_field_name_for_value:[value+v=777],fake_field_name_for_children:[child]}}
... since by design {{[child]}} can now add _multiple_ "fields" to the
document, this syntax doesn't really make sense anyway.
A "cleaner" fix for this (that might be more generally useful down the road
then just changing all response writers to do instanceof checks for
SolrDocument) would probably be to add a callback method to
DocTransformer/ReturnFields, as a corrollary to
{{DocTransformer.getExtraRequestFields()}} but for modifing the behavior of
{{ReturnFields.wantsField()}} ... something like
{{DocTransformer.getExtraResponseFields()}}
> [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]