Hello, Thomas.

I think we never think about singleton as a special case, never distinguish
it from array.


On Sun, May 1, 2022 at 5:03 PM Thomas Corthals <tho...@klascement.net>
wrote:

> When I put only one child document in a field with the same name, it's
> indexed as a "multivalued" child document.
>
> <doc>
>   <field name="id">1</field>
>   <field name="single_child">
>     <doc>
>       <field name="id">2</field>
>     </doc>
>   </field>
>   <field name="children">
>     <doc>
>       <field name="id">3</field>
>     </doc>
>     <doc>
>       <field name="id">4</field>
>     </doc>
>   </field>
> </doc>
>
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":2,
>     "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"}]}]
>   }}
>
>
if the problem is an array
        "single_child":*[*
          {
            "id":"2"}*]*,
I believe it's inserted in ChildDocTransformer#addChildrenToParent(), and
perhaps can be hacked in custom transformer.


-- 
Sincerely yours
Mikhail Khludnev

Reply via email to