Hi Mikhail,

The JSON Loader does distinguish a singleton from an array in
JsonLoader#buildDoc() and JsonLoader#mapEntryIsChildDoc(). I've opened an
issue in JIRA with a syntax proposal for XML:
https://issues.apache.org/jira/browse/SOLR-16183

It looks like it would be a small adjustment, but I only read Java and
don't really speak it.

Thomas

Op zo 1 mei 2022 om 22:44 schreef Mikhail Khludnev <m...@apache.org>:

> 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