Solr by adding entry via JSON with multivalued field and incremented values

I'm new to Solr, I'm trying to add a multivalued field with boost values ​​defined for each value, all defined via JSON. In other words, I would like this to work:

[{ "id": "ID1000",
  "tag": [ 
    { "boost": 1, "value": "A test value" }, 
    { "boost": 2, "value": "A boosted value" } ]
}]

      

I know how to do it in XML (somewhat <field name = 'tag' boost = '...'>

), but the above JSON code doesn't work, the server says "Error parsing JSON field value. Unexpected OBJECT_START". Does Solr have a limitation / bug?

PS: I fixed the originally missing ']' and this is not a problem.

EDIT: It seems like the path should be helpful ( http://wiki.apache.org/solr/Payloads ), but I couldn't get them to work on Solr (after that: http://sujitpal.blogspot.co.uk/ 2011/01 / payloads-with-solr.html ). Leaving the question open to see if someone can help.

+3


source to share


5 answers


Found the following suggestion from the Solr Relevancy FAQ Section - Elevation Component

Time index acceleration for a multi-valued field value is applied to all values ​​for that field.

I don't think adding an individual boost to each value in a multivalued field will work. I know the Xml will allow this, but I would assume it can only apply the boost value from the last value applied to the field.



So, based on that, I would change the Json to the following and see if that works.

[
    {
        "id": "ID1000",
        "tag": {
           "boost": 2, 
           "value": [ "A test value", "A boosted value"]
         }
    }
]

      

+4


source


JSON seems to be invalid if closure is missing ]



[
    {
        "id": "ID1000",
        "tag": [
            {
                "boost": 1,
                "value": "A test value"
            },
            {
                "boost": 2,
                "value": "A boosted value"
            }
        ]
    }
]

      

0


source


You will hit the edge. You can have a boost on individual values ​​and you can have an array of values. But not one inside the other (from my reading of the Solr 4.1 source code )

It could be something to create as a request for improvement .

If you are creating JSON manually, you can try:

"tag": { "boost": 1, "value": "A test value" }, 
"tag": { "boost": 2, "value": "A boosted value" }

      

I believe Sols will then combine the values. But if you create it through a framework, it will likely disallow or override multiple object property names (here).

0


source


The error has nothing to do with promotion. I am getting the same error with a very simple json doc. No luck resolving this. see Solr Errors When Trying to Parse Collection: Error parsing JSON field value. Unused OBJECT_START

0


source


I am getting the same error message. In fact, the error message was misplaced. The main real mistake was that the two required fields as per schema.xml in the solr config were missing from the json payload.

An error message like "required parameters are missing in document" would be more helpful here. You might want to check if some required fields are missing from the json payload.

0


source







All Articles