[
https://issues.apache.org/jira/browse/SOLR-9477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16532935#comment-16532935
]
Vasili Logvinov edited comment on SOLR-9477 at 7/4/18 4:34 PM:
---------------------------------------------------------------
I found workaround for myself.
<dataConfig>
*<script>*
*<![CDATA[*
*function GenerateId(row){*
*row.put('id', java.util.UUID.randomUUID().toString());return row;*
*}*
*]]>*
*</script>*
<document>
<entity name="parent" pk="id" query=".......">
<entity name="child" pk="+id+" child="true" query="......."
*transformer="script:+GenerateId+"*>
</entity>
</entity>
</document>
</dataConfig>
was (Author: v.logvinov):
I found workaround for myself.
<dataConfig>
*<script><![CDATA[function +GenerateId+(row) {row.put('+id+',
java.util.UUID.randomUUID().toString());return row;}]]></script>*
<document>
<entity name="parent" pk="id" query=".......">
<entity name="child" pk="+id+" child="true" query="......."
*transformer="script:+GenerateId+"*>
</entity>
</entity>
</document>
</dataConfig>
> UpdateRequestProcessors ignore child documents
> ----------------------------------------------
>
> Key: SOLR-9477
> URL: https://issues.apache.org/jira/browse/SOLR-9477
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Affects Versions: 6.2, 7.0
> Reporter: Alexandre Rafalovitch
> Assignee: Alexandre Rafalovitch
> Priority: Major
> Labels: UpdateProcessor
>
> UpdateRequestProcessors completely ignore child documents. The only exception
> is AddSchemaFieldsUpdateProcessorFactory. The rest seem to be completely
> unaware that SolrInputDocument has getChildDocuments() or related methods.
> Easy test (on Solr 6.2):
> This works (with IDs auto-assigned and field names generated):
> {code}
> bin/solr create -c childtest
> bin/post -c childtest -type application/json -format solr -d '[{"a":1,"b":2}]'
> {code}
> This fails as the second/third command, with "missing ID field":
> {code}
> bin/post -c childtest -type application/json -format solr -d
> '[{"a":1,"b":2,"_childDocuments_":[{"c":3,"d":4}]}]'
> {code}
> The message:
> {noformat}
> SimplePostTool version 5.0.0
> POSTing args to http://localhost:8983/solr/childtest/update...
> SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url:
> http://localhost:8983/solr/childtest/update
> SimplePostTool: WARNING: Response:
> {"responseHeader":{"status":400,"QTime":4},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"[doc=null]
> missing required field: id","code":400}}
> SimplePostTool: WARNING: IOException while reading response:
> java.io.IOException: Server returned HTTP response code: 400 for URL:
> http://localhost:8983/solr/childtest/update
> COMMITting Solr index changes to
> http://localhost:8983/solr/childtest/update...
> Time spent: 0:00:00.042
> {noformat}
> I also verified it with BlankRemoving URP. I think this is a global problem.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]