You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Thomas Corthals (Jira)" <ji...@apache.org> on 2022/05/05 13:11:00 UTC
[jira] [Commented] (SOLR-16183) XML Loader: support indexing single nested child document
[ https://issues.apache.org/jira/browse/SOLR-16183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17532237#comment-17532237 ]
Thomas Corthals commented on SOLR-16183:
----------------------------------------
The JSON Loader recognises both "single-valued" and "multi-valued" pseudo-fields for labelled nested children.
{code:json}
{
"id": "1",
"single_child": {
"id": "2"
},
"children": [{
"id": "3"
},
{
"id": "4"
}]
}
{code}
This can be queried with {{q=id:1&fl=id,single_child,children,[child]}} to retrieve the nesting as indexed.
{code:json}
{
"responseHeader":{
"status":0,
"QTime":1,
"params":{
"q":"id:1",
"fl":"id,single_child,children,[child]"}},
"response":{"numFound":1,"start":0,"numFoundExact":true,"docs":[
{
"id":"1",
"single_child":
{
"id":"2"},
"children":[
{
"id":"3"},
{
"id":"4"}]}]
}}
{code}
The same response with {{q=id:1&fl=id,single_child,children,[child]&wt=xml}} shows the indexed structure in XML.
{code:xml}
<?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">id,single_child,children,[child]</str>
<str name="wt">xml</str>
</lst>
</lst>
<result name="response" numFound="1" start="0" numFoundExact="true">
<doc>
<str name="id">1</str>
<doc name="single_child">
<str name="id">2</str></doc>
<arr name="children">
<doc>
<str name="id">3</str></doc>
<doc>
<str name="id">4</str></doc>
</arr></doc>
</result>
</response>
{code}
However, there is currently no way to have this exact structure indexed with the XML Loader. Borrowing from the XML response, it would make sense to support a {{name}} attribute on a not-in-a-{{<field>}} nested {{<doc>}} to achieve this.
{code:xml}
<doc>
<field name="id">1</field>
<doc name="single_child">
<field name="id">2</field>
</doc>
<field name="children">
<doc>
<field name="id">3</field>
</doc>
<doc>
<field name="id">4</field>
</doc>
</field>
</doc>
{code}
> XML Loader: support indexing single nested child document
> ---------------------------------------------------------
>
> Key: SOLR-16183
> URL: https://issues.apache.org/jira/browse/SOLR-16183
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Thomas Corthals
> Priority: Major
>
> The XML Loader always treats labelled nested children as a "multi-valued pseudo-field", whereas the JSON Loader can also index a single child document as well as an array of 1..n child documents.
> The XML Loader should have a corresponding syntax for a single labelled nested child.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org