Thanks, found the problem and fixed my writer

2014-10-09 2:00 GMT+02:00 Chris Hostetter <hossman_luc...@fucit.org>:

>
> : i try to add documents to the index and boost them (hole document) but i
> : get this error message:
> :
> : ERROR org.apache.solr.core.SolrCore  –
> : org.apache.solr.common.SolrException: Error parsing JSON field value.
> : Unexpected OBJECT_START
> :
> : Any ideas?
>
> The top level structure you are sending is a JSON array (because you start
> with "[") which is how you tell solr you want to send a simple list of
> documents to add.
>
> In order to send explicit commands (like "add") your top level JSON
> structure needs to be JSON Object (aka: Map), which contains "add" as a
> key.
>
> there are examples of this in the ref guide...
>
>
> https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers#UploadingDatawithIndexHandlers-SendingArbitraryJSONUpdateCommands
>
> so basically, just take your list containing 2 objects that each have 1
> key of "add" and replace it with a single obejct that has 2 "add" keys...
>
> :     {
> :         "add": {
> :             "boost": 1,
> :             "doc": {
> :                 "store_id": 1,
> :                 "created_at": "2007-08-23T01:03:05Z",
> :                 "sku": {"boost": 10, "value": "n2610"},
> :                 "status": "1",
> :                 "tax_class_id_t": "2",
> :                 "color_t": "Black",
> :                 "visibility": "4",
> :                 "name": {"boost": -60, "value": "Nokia 2610 Phone"},
> :                 "url_key": "nokia-2610-phone",
> :                 "image": "\/n\/o\/nokia-2610-phone-2.jpg",
> :                 "small_image": "\/n\/o\/nokia-2610-phone-2.jpg",
> :                 "thumbnail": "\/n\/o\/nokia-2610-phone-2.jpg",
> :                 "msrp_enabled_t": "2",
> :                 "msrp_display_actual_price_type_t": "4",
> :                 "model_t": "2610",
> :                 "dimension_t": "4.1 x 1.7 x 0.7 inches",
> :                 "meta_keyword_t": "Nokia 2610, cell, phone,",
> :                 "short_description": "The words \"entry level\" no longer
> : mean \"low-end,\" especially when it comes to the Nokia 2610. Offering
> : advanced media and calling features without breaking the bank",
> :                 "price": "149.99",
> :                 "in_stock": "1",
> :                 "id": "16_1",
> :                 "product_id": "16",
> :                 "content_type": "product",
> :                 "attribute_set_id": "38",
> :                 "type_id": "simple",
> :                 "has_options": "0",
> :                 "required_options": "0",
> :                 "entity_type_id": "10",
> :                 "category": [
> :                     8,
> :                     13
> :                 ]
> :             }
> :         }
>           ,
> :         "add": {
> :             "boost": 1,
> :             "doc": {
> :                 "store_id": 1,
> :                 "created_at": "2007-08-23T03:40:26Z",
> :                 "sku": {"boost": 10, "value": "bb8100"},
> :                 "color_t": "Silver",
> :                 "status": "1",
> :                 "tax_class_id_t": "2",
> :                 "visibility": "4",
> :                 "name": {"boost": -60, "value": "BlackBerry 8100 Pearl"},
> :                 "url_key": "blackberry-8100-pearl",
> :                 "thumbnail": "\/b\/l\/blackberry-8100-pearl-2.jpg",
> :                 "small_image": "\/b\/l\/blackberry-8100-pearl-2.jpg",
> :                 "image": "\/b\/l\/blackberry-8100-pearl-2.jpg",
> :                 "model_t": "8100",
> :                 "dimension_t": "4.2 x 2 x 0.6 inches",
> :                 "meta_keyword_t": "Blackberry, 8100, pearl, cell, phone",
> :                 "short_description": "The BlackBerry 8100 Pearl is a
> : departure from the form factor of previous BlackBerry devices. This
> : BlackBerry handset is far more phone-like, and RIM's engineers have
> managed
> : to fit a QWERTY keyboard onto the handset's slim frame.",
> :                 "price": "349.99",
> :                 "in_stock": "1",
> :                 "id": "17_1",
> :                 "product_id": "17",
> :                 "content_type": "product",
> :                 "attribute_set_id": "38",
> :                 "type_id": "simple",
> :                 "has_options": "0",
> :                 "required_options": "0",
> :                 "entity_type_id": "10",
> :                 "category": [
> :                     8,
> :                     13
> :                 ]
> :             }
> :         }
> :     }
>
>
> -Hoss
> http://www.lucidworks.com/

Reply via email to