'Solr indexing nested objects array

We're trying to run an index in Solr (8.9.0 - Schemaless Mode) of a list of items that each contain 1 or 2 arrays of objects, with 1 or more records per array. The sample code below is the json we feed the index:

[
    {
        "id": 8270861,
        "type": "Product",
        "title": "Stripped T-shirt"
        "tags": [{
            "tagId": 218,
            "tagIcon": "smile,happy",
            "tagHelpText": "",
            "tagValue": "grand"
        },
        {
            "tagId": 219,
            "tagIcon": "frown,sad",
            "tagHelpText": "",
            "tagValue": "grand"
        }],
        "keywords": [
        {
            "keywordId": 742,
            "type": "color"
        },
        {
            "keywordId": 743,
            "type": "size"
        }]
    }
]

2 problems we run into:

PROBLEM 1: The output of the solr query changes the format of the arrays to this (effectively removing the quotes):

...
                "tags": [
                    "{tagIcon=smile,happy, tagHelpText=, tagId=218, tagValue=grand}",
                    "{tagIcon=frown,sad, tagHelpText=, tagId=219, tagValue=grand}"
                ],
                "keywords": [
                    "{type=color, keywordId=742}",
                    "{type=size, keywordId=743}"
                ],
...

Is there a way to get the format of the arrays to come back the same way as fed into the index:

"tags": [
{ "tagId": 218, "tagIcon": "smile,happy", "tagHelpText": "", "tagValue": "grand" },
{ "tagId": 219, "tagIcon": "frown,sad", "tagHelpText": "", "tagValue": "grand"}
]

to avoid any conflicts when the value is a comma separated list. Are we missing some definition adjustments in the schema file? If so do we need to define the children of those parent keys(i.e. "tags.tagIcon")?

PROBLEM 2: The index seems to reject an array with a single element. If we feed it the same json as above, but only one entry in the keywords array (or the tags array):

...
        "keywords": [
        {
            "keywordId": 742,
            "type": "color"
        }]
...

it throws a code: 400 Unknown operation for the an atomic update: type" Any suggestions on this would be welcome.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source