Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B82C417A59 for ; Mon, 13 Oct 2014 09:32:00 +0000 (UTC) Received: (qmail 59335 invoked by uid 500); 13 Oct 2014 09:31:57 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 59270 invoked by uid 500); 13 Oct 2014 09:31:57 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 59257 invoked by uid 99); 13 Oct 2014 09:31:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Oct 2014 09:31:56 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of daim1985@gmail.com designates 209.85.213.174 as permitted sender) Received: from [209.85.213.174] (HELO mail-ig0-f174.google.com) (209.85.213.174) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Oct 2014 09:31:52 +0000 Received: by mail-ig0-f174.google.com with SMTP id a13so9762086igq.1 for ; Mon, 13 Oct 2014 02:31:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LCXFOjaGsqBrCU0Vk39+fsCxtyyLd5vkHf8vO6YfSZY=; b=tLXkSNzSVOG41u/OTHMw/iMQdXA1Af5jDj1xo6EO0fIyaLa+kggNMe3vcygwxigJph As8R0GJaBhQjKFcrG9K7qrNyoOo7/cZ7LCOQfGOXOPDgdtaqj09yZFBWJk6v0vPXB53n Q9GuC2L20O4olSovuCtT3oNI13UI3aRQJLW4Rk1U8bwQEkycbDAq9KC1T+ZRejxqe/LY 0qX0N8NJZs2+nUERU5DUHTIL5NdqJApfuiw9jnrQsi7EYTl023XvIHRKsmPOV+mpg1pb Wfwpf+VSC1h5s/rOj60Y2mm/lV01wiCQBic1Y1s7MxCBdT2oMwNGnZCyznCPGvhL5XGg jS+A== MIME-Version: 1.0 X-Received: by 10.50.124.130 with SMTP id mi2mr39455091igb.0.1413192692031; Mon, 13 Oct 2014 02:31:32 -0700 (PDT) Received: by 10.107.157.137 with HTTP; Mon, 13 Oct 2014 02:31:31 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Oct 2014 11:31:31 +0200 Message-ID: Subject: Re: Add multiple JSON documents with boost From: Damian Luszczymak To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a1134a64268675405054a90df X-Virus-Checked: Checked by ClamAV on apache.org --001a1134a64268675405054a90df Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, found the problem and fixed my writer 2014-10-09 2:00 GMT+02:00 Chris Hostetter : > > : 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 =E2=80=93 > : 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 star= t > 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+Inde= x+Handlers#UploadingDatawithIndexHandlers-SendingArbitraryJSONUpdateCommand= s > > 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 long= er > : 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/ --001a1134a64268675405054a90df--