The books.json in example/exampledocs has:

"cat" : ["book","hardcover"],

That is "book" singular, not "books" plural as in your query. There is no stemming since it is a string field, not text.

-- Jack Krupansky

-----Original Message----- From: Rajesh Jain
Sent: Monday, May 14, 2012 2:42 PM
To: solr-user@lucene.apache.org
Subject: Re: Update JSON not working for me

Hi Jack

I am following the http://wiki.apache.org/solr/UpdateJSON tutorials.

The first example is of books.json, which  I executed, but I dont see any
books

http://localhost:8983/solr/collection1/browse?q=cat%3Dbooks

0 results found in 26 ms Page 0 of 0

I modified the books.json to add my own book, but still no result. The
money.xml works, so I converted the money.xml to money.json and added an
extra currency. I don't see the new currency.

My question is, how do I know if the UpdateJSON action was valid, if I
don't see them in the
http://localhost:8983/solr/collection1/browse?q=cat%3Dbooks

Is there a way to find what is happening - maybe through log files?

I am new to Solr, please help

Thanks
Rajesh




On Mon, May 14, 2012 at 2:33 PM, Jack Krupansky <j...@basetechnology.com>wrote:

Check the examples of update/json here:

http://wiki.apache.org/solr/**UpdateJSON<http://wiki.apache.org/solr/UpdateJSON>

In your case, either leave out the "add" level or add a "doc" level below
it.

For example:

curl http://localhost:8983/solr/**update/json<http://localhost:8983/solr/update/json>-H 'Content-type:application/
**json' -d '
{
"add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
"add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
}'

-- Jack Krupansky

-----Original Message----- From: Rajesh Jain
Sent: Monday, May 14, 2012 1:27 PM
To: solr-user@lucene.apache.org
Cc: Rajesh Jain
Subject: Update JSON not working for me


Hi,

I am using the 4.x version of Solr, and following the UpdateJSON Solr Wiki

1. When I try to update using :

curl 'http://localhost:8983/solr/**update/json?commit=true<http://localhost:8983/solr/update/json?commit=true>
'
--data-binary @books.json -H 'Content-type:application/**json'

I don't see any Category as Books in Velocity based Solr Browser the
http://localhost:8983/solr/**collection1/browse/<http://localhost:8983/solr/collection1/browse/>
?

I see the following message on the startup window when I run this command
C:\Tools\Solr\apache-solr-4.0-**2012-05-04_08-23-31\example\**
exampledocs>C:\tools\curl\curl
http://localhost:8983/solr/**update/json?commit=true<http://localhost:8983/solr/update/json?commit=true>--data-binary
@books
.json -H 'Content-type:application/**json'
{
 "responseHeader":{
  "status":0,
  "QTime":47}}

2. I wrote my own JSON file where I added an extra "add" directive

My JSON File
[
 {
"add":{
"id" : "MXN",
"cat" : ["currency"],
"name" : "One Peso",
"inStock" : true,
"price_c" : "1,MXN",
"manu" : "384",
"manu_id_s" : "Bank Mexico",
"features":"Coins and notes"
    }
  }
]

I still don't see the addition in the existing Currency Categories.


Please let me know if the UPDATEJSON works in 4.x or is this only for 3.6?

Thanks
Rajesh


Reply via email to