Re: Update JSON not working for me

2012-05-16 Thread Lance Norskog
This is my json variant of solr/example/exampledocs/post.sh. It takes
an url as the first parameter.

#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

URL="$1"
shift
FILES=$@

for f in $FILES; do
  echo Posting file $f to $URL
  curl "$URL" --data-binary "@$f" -H 'Content-type:text/plain'
  echo
done

#send the commit command to make sure all the changes are flushed and visible
curl $URL --data-binary '{"commit":{}}' -H 'Content-type:application/json'
echo


Re: Update JSON not working for me

2012-05-16 Thread rjain15
Yonik

You are the best !!!

Yes, as soon as I changed the "Content-type:application/json" it worked. 

Now I can see all my updates to the book category. 

I am ready to roll, thanks for the patience and help. 

regards
Rajesh

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Update-JSON-not-working-for-me-tp3983709p3984236.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Update JSON not working for me

2012-05-16 Thread Yonik Seeley
On Wed, May 16, 2012 at 4:10 PM, rjain15  wrote:
> Hi
>
> Firstly, apologies for the long post, I changed the quote to double quote
> (and sometimes it is messy copying from DOS windows)
>
> Here is the command and the output on the Jetty Server Window. I am
> highlighting some important pieces,
> I have enabled the LOG LEVEL to DEBUG on the JETTY window.
>
> C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
> "http://localhost:8983/solr/update?commit=true"; --data-binary @books.js
> on -H 'Content-type:application/json'



> May 16, 2012 4:05:49 PM org.apache.solr.update.processor.LogUpdateProcessor
> finish
> INFO: [collection1] webapp=/solr path=/update params={commit=true&[
>  {
>    "id" : "978-0641723445",

There ya go - what should be the body of the post is in fact used as a
very large parameter name.
I get this behavior when I leave off the -H
'Content-type:application/json' when trying this on UNIX.

This means that your content-type is not being set correctly by your
curl command.
Did you try changing those single quotes to double quotes at the end?

C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
"http://localhost:8983/solr/update?commit=true"; --data-binary
@books.js -H "Content-type:application/json"

-Yonik
http://lucidimagination.com


Re: Update JSON not working for me

2012-05-16 Thread rjain15
Hi 

Firstly, apologies for the long post, I changed the quote to double quote
(and sometimes it is messy copying from DOS windows)

Here is the command and the output on the Jetty Server Window. I am
highlighting some important pieces, 
I have enabled the LOG LEVEL to DEBUG on the JETTY window. 

C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
"http://localhost:8983/solr/update?commit=true"; --data-binary @books.js
on -H 'Content-type:application/json'



01930




2012-05-16 16:05:49.636:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.core.IndexDeletionPolicyWrapper$IndexCommitWrapper from
WebAppClassLoader=sol
May 16, 2012 4:05:49 PM org.apache.solr.core.SolrDeletionPolicy onInit
INFO: SolrDeletionPolicy.onInit: commits:num=1
   
commit{dir=C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\solr\data\index,segFN=segments_3,generation=3,filenames=[_1_nrm.cfs,
_0_0.frq, _0
May 16, 2012 4:05:49 PM org.apache.solr.core.SolrDeletionPolicy
updateCommits
*INFO: newest commit = 3*
2012-05-16 16:05:49.723:DBUG:oejw.WebAppClassLoader:loaded interface
java.util.concurrent.Future
2012-05-16 16:05:49.737:DBUG:oejw.WebAppClassLoader:loaded interface
java.util.concurrent.Future from null
May 16, 2012 4:05:49 PM org.apache.solr.update.DirectUpdateHandler2 commit
INFO: start
commit{flags=0,version=0,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false}
2012-05-16 16:05:49.781:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.lucene.index.BufferedDeletesStream$ApplyDeletesResult from
WebAppClassLoader=solr@
May 16, 2012 4:05:49 PM org.apache.solr.search.SolrIndexSearcher 
INFO: Opening Searcher@1cac622a main
2012-05-16 16:05:49.835:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.core.SolrCore$2 from WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:49.849:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.core.SolrCore$4 from WebAppClassLoader=solr@62ebcdbb
May 16, 2012 4:05:49 PM org.apache.solr.update.DirectUpdateHandler2 commit
INFO: end_commit_flush
2012-05-16 16:05:49.865:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.search.SolrIndexSearcher$8 from
WebAppClassLoader=solr@62ebcdbb
May 16, 2012 4:05:49 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener sending requests to Searcher@1cac622a
main{StandardDirectoryReader(segments_3:5 _0(4.0):Cv32 _1(4.0):C2)}
May 16, 2012 4:05:49 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener done.
May 16, 2012 4:05:49 PM org.apache.solr.core.SolrCore registerSearcher
INFO: [collection1] Registered new searcher Searcher@1cac622a
main{StandardDirectoryReader(segments_3:5 _0(4.0):Cv32 _1(4.0):C2)}
May 16, 2012 4:05:49 PM org.apache.solr.update.processor.LogUpdateProcessor
finish
INFO: [collection1] webapp=/solr path=/update params={commit=true&[
  {
"id" : "978-0641723445",
"cat" : ["book","hardcover"],
"name" : "The Lightning Thief",
"author" : "Rick Riordan",
"series_t" : "Percy Jackson and the Olympians",
"sequence_i" : 1,
"genre_s" : "fantasy",
"inStock" : true,
"price" : 12.50,
"pages_i" : 384
  }
,
  {
"id" : "978-1423103349",
"cat" : ["book","paperback"],
"name" : "The Sea of Monsters",
"author" : "Rick Riordan",
"series_t" : "Percy Jackson and the Olympians",
"sequence_i" : 2,
"genre_s" : "fantasy",
"inStock" : true,
"price" : 6.49,
"pages_i" : 304
  }
,
  {
"id" : "978-1857995879",
"cat" : ["book","paperback"],
"name" : "Sophie's World : The Greek Philosophers",
"author" : "Jostein Gaarder",
"sequence_i" : 1,
"genre_s" : "fantasy",
"inStock" : true,
"price" : 3.07,
"pages_i" : 64
  }
,
  {
"id" : "978-1933988177",
"cat" : ["book","paperback"],
"name" : "Lucene in Action, Second Edition",
"author" : "Michael McCandless",
"sequence_i" : 1,
"genre_s" : "IT",
"inStock" : true,
"price" : 30.50,
"pages_i" : 475
  }
]
=} {commit=} 0 1930
2012-05-16 16:05:50.621:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.response.TextResponseWriter from
WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:50.634:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.response.XMLWriter from WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:50.651:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.lucene.document.Document from WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:50.666:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.common.SolrDocument from WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:50.683:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.common.SolrDocumentList from WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:50.698:DBUG:oejw.WebAppClassLoader:loaded class
org.apache.solr.common.util.XML from WebAppClassLoader=solr@62ebcdbb
2012-05-16 16:05:50.713:DBUG:oejs.Server:RESPONSE /solr/update  200
2012-05-16 16:05:50.743:DBUG:

Re: Update JSON not working for me

2012-05-16 Thread Michael Della Bitta
Lookout, the first end quote is in the wrong spot.

Michael

On Wed, May 16, 2012 at 3:29 PM, Yonik Seeley
 wrote:
> On Wed, May 16, 2012 at 2:36 PM, rjain15  wrote:
>> No. Changing to name:monsters didn't work
>
> OK, but you'll have to do that if you get the other part working.
>
>> Here is my guess, the UpdateJSON is not adding any new documents to the
>> existing index.
>
> If that's true, the most likely culprit is your curl on windows (or
> the windows shell).
> You mentioned removing the single quotes in the curl command?  Perhaps
> try replacing all those with double quotes.
>
> C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
> "http://localhost:8983/solr/update?commit=true --data-binary" @books.json -H
> "Content-type:application/json"
>
>
> I'd really recommend installing cygwin if you know any unix at all...
> not required, but will make your life much easier.
>
> -Yonik
> http://lucidimagination.com


Re: Update JSON not working for me

2012-05-16 Thread Yonik Seeley
On Wed, May 16, 2012 at 2:36 PM, rjain15  wrote:
> No. Changing to name:monsters didn't work

OK, but you'll have to do that if you get the other part working.

> Here is my guess, the UpdateJSON is not adding any new documents to the
> existing index.

If that's true, the most likely culprit is your curl on windows (or
the windows shell).
You mentioned removing the single quotes in the curl command?  Perhaps
try replacing all those with double quotes.

C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
"http://localhost:8983/solr/update?commit=true --data-binary" @books.json -H
"Content-type:application/json"


I'd really recommend installing cygwin if you know any unix at all...
not required, but will make your life much easier.

-Yonik
http://lucidimagination.com


Re: Update JSON not working for me

2012-05-16 Thread rjain15
Hi, 

No. Changing to name:monsters didn't work

Here is my guess, the UpdateJSON is not adding any new documents to the
existing index. 

The document count remains the same after I call the UpdateJSON. 

I am new to Solr, my guess is that if there is some underlying schema that
dictates what can be added, maybe we have to fix that. 

I created a money.json which is modelled on the existing money.xml and tried
to added a currency to the existing currencies, but it doesn't work either. 

The XML Updates handler works perfectly fine, it's the JSON handler which is
causing me the troubles. 

I am ready to dig deeper, if you can tell me what to look for...

Thanks
Rajesh


--
View this message in context: 
http://lucene.472066.n3.nabble.com/Update-JSON-not-working-for-me-tp3983709p3984205.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Update JSON not working for me

2012-05-16 Thread Yonik Seeley
On Wed, May 16, 2012 at 1:43 PM, rjain15  wrote:
> http://localhost:8983/solr/select?q=title:monsters&wt=json&indent=true

Try switching title:monsters to name:monsters
https://issues.apache.org/jira/browse/SOLR-2598

Looks like the data was changed to use the name field instead and the
docs were never updated (big downside to our non-versioned docs).

-Yonik
http://lucidimagination.com


Re: Update JSON not working for me

2012-05-16 Thread rjain15
Hi

I have tried with the latest nightly build
apache-solr-4.0-2012-05-15_08-20-37

I am trying on a Windows 64 bit OS, I believe you have tested this on the
LINUX box (based on the shell script)

Not sure what I am missing, but the doesn't seem to work: 
I have changed the URL to just call the update?commit=true
Secondly, I have removed the extra quote in the URL for CURL, Windows
doesn't seem to like. 


C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
http://localhost:8983/solr/update?commit=true --data-binary @books.json -H
'Content-type:application/json'



0195



My output is 

http://localhost:8983/solr/select?q=title:monsters&wt=json&indent=true

{
  "responseHeader":{
"status":0,
"QTime":1,
"params":{
  "indent":"true",
  "wt":"json",
  "q":"title:monsters"}},
  "response":{"numFound":0,"start":0,"docs":[]
  }}

Has anyone tried this with the latest nightly build on Windows 64 bit OS?

Trying to figure out what is the difference.

Thanks
Rajesh



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Update-JSON-not-working-for-me-tp3983709p3984184.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Update JSON not working for me

2012-05-16 Thread rjain15
Hi

I have tried with the latest nightly build
apache-solr-4.0-2012-05-15_08-20-37

I am trying on a Windows 64 bit OS, I believe you have tested this on the
LINUX box (based on the shell script)

Not sure what I am missing, but the doesn't seem to work: 
I have changed the URL to just call the update?commit=true
Secondly, I have removed the extra quote in the URL for CURL, Windows
doesn't seem to like. 


C:\Tools\Solr\apache-solr-4.0-2012-05-15_08-20-37\example\exampledocs>C:\tools\curl\curl
http://localhost:8983/solr/update?commit=true --data-binary @books.json -H
'Content-type:application/json'



0195



My output is 

http://localhost:8983/solr/select?q=title:monsters&wt=json&indent=true

{
  "responseHeader":{
"status":0,
"QTime":1,
"params":{
  "indent":"true",
  "wt":"json",
  "q":"title:monsters"}},
  "response":{"numFound":0,"start":0,"docs":[]
  }}

Has anyone tried this with the latest nightly build on Windows 64 bit OS?

Trying to figure out what is the difference.

Thanks
Rajesh



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Update-JSON-not-working-for-me-tp3983709p3984185.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Update JSON not working for me

2012-05-14 Thread rjain15
I haven't modified any schema or config. I am going to do it all over...clean
install. 

I tried with 3.6 and I have the same issue. 

I am going to try with 4.x one more time, its been painful, I am so excited
to use Solr for my project, and seems I am stuck on the basics. 

Thanks
Rajesh


--
View this message in context: 
http://lucene.472066.n3.nabble.com/Update-JSON-not-working-for-me-tp3983709p3983759.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Update JSON not working for me

2012-05-14 Thread Yonik Seeley
On Mon, May 14, 2012 at 3:11 PM, Rajesh Jain  wrote:
> Hi Yonik
>
> i tried without the json in the URL, the result was same but in XML format

Interesting... the XML response is fine (just not ideal).

When I tried it, I did get a JSON response (perhaps I'm running a
later version of trunk... the unified update handler is very new)

$ curl 'http://localhost:8983/solr/update?commit=true' --data-binary
@books.json -H 'Content-type:application/json'
{"responseHeader":{"status":0,"QTime":133}}

-Yonik
http://lucidimagination.com


>
> C:\Tools\Solr\apache-solr-4.0-2012-05-04_08-23-31\example\exampledocs>C:\tools\curl\curl
> http://localhost:8983/solr/update?commit=true --data-binary @money.json -H
> 'Content-type:application/json'
> 
> 
> 0 name="QTime">45 /lst>
> 
>
>
>
>
> On Mon, May 14, 2012 at 2:58 PM, Yonik Seeley 
> wrote:
>>
>> I think this may be due to https://issues.apache.org/jira/browse/SOLR-2857
>> JIRA is down right now so I can't check, but I thought the intent was
>> to have some back compat.
>>
>> Try changing the URL from /update/json to just /update in the meantime
>>
>> -Yonik
>> http://lucidimagination.com
>>
>>
>> On Mon, May 14, 2012 at 2:42 PM, Rajesh Jain  wrote:
>> > 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
>> > wrote:
>> >
>> >> Check the examples of update/json here:
>> >>
>> >>
>> >> 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-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
>> >> '
>> >> --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/
>> >> ?
>> >>
>> >> 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--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
>> >>
>
>


Re: Update JSON not working for me

2012-05-14 Thread Jack Krupansky
I just tried update/json myself with example (no changes) for both 3.6 and 
the same trunk build as you used, and it works fine for me - I get 4 docs 
for cat:book.


Did you modify the schema or config?

-- Jack Krupansky

-Original Message- 
From: Rajesh Jain

Sent: Monday, May 14, 2012 3:11 PM
To: solr-user@lucene.apache.org ; yo...@lucidimagination.com
Subject: Re: Update JSON not working for me

Hi Yonik

i tried without the json in the URL, the result was same but in XML format

C:\Tools\Solr\apache-solr-4.0-2012-05-04_08-23-31\example\exampledocs>C:\tools\curl\curl
http://localhost:8983/solr/update?commit=true --data-binary @money.json -H
'Content-type:application/json'


045





On Mon, May 14, 2012 at 2:58 PM, Yonik Seeley 
wrote:



I think this may be due to https://issues.apache.org/jira/browse/SOLR-2857
JIRA is down right now so I can't check, but I thought the intent was
to have some back compat.

Try changing the URL from /update/json to just /update in the meantime

-Yonik
http://lucidimagination.com


On Mon, May 14, 2012 at 2:42 PM, Rajesh Jain  wrote:
> 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 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
>>





Re: Update JSON not working for me

2012-05-14 Thread Rajesh Jain
Hi Yonik

i tried without the json in the URL, the result was same but in XML format

C:\Tools\Solr\apache-solr-4.0-2012-05-04_08-23-31\example\exampledocs>C:\tools\curl\curl
http://localhost:8983/solr/update?commit=true --data-binary @money.json -H
'Content-type:application/json'


045





On Mon, May 14, 2012 at 2:58 PM, Yonik Seeley wrote:

> I think this may be due to https://issues.apache.org/jira/browse/SOLR-2857
> JIRA is down right now so I can't check, but I thought the intent was
> to have some back compat.
>
> Try changing the URL from /update/json to just /update in the meantime
>
> -Yonik
> http://lucidimagination.com
>
>
> On Mon, May 14, 2012 at 2:42 PM, Rajesh Jain  wrote:
> > 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  >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
> >>
>


Re: Update JSON not working for me

2012-05-14 Thread Rajesh Jain
Jack

I tried with cat=book which was in books.json and in my smaller demo file,
I had it as books, in either case it doesn't seem to work.

>From the example on http://wiki.apache.org/solr/UpdateJSON
http://localhost:8983/solr/select?q=title:monsters&wt=json&indent=true
This should result in out book, but

My output is

{
  "responseHeader":{
"status":0,
"QTime":1,
"params":{
  "indent":"true",
  "wt":"json",
  "q":"title:monsters"}},
  "response":{"numFound":0,"start":0,"docs":[]
  }}


Where is the json data stored ? Is it in the data folder, I can remove
everything from the folder and see what happens?

Thanks
Rajesh


On Mon, May 14, 2012 at 3:03 PM, Jack Krupansky wrote:

> 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<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<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<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 *
> *wrote:
>
>  Check the examples of update/json here:
>>
>> http://wiki.apache.org/solr/UpdateJSON<http://wiki.apache.org/solr/**UpdateJSON>
>> <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>
>> <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>
>> 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/>
>> <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>
>> 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
>>
>>
>


Re: Update JSON not working for me

2012-05-14 Thread Jack Krupansky

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 
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





Re: Update JSON not working for me

2012-05-14 Thread Yonik Seeley
I think this may be due to https://issues.apache.org/jira/browse/SOLR-2857
JIRA is down right now so I can't check, but I thought the intent was
to have some back compat.

Try changing the URL from /update/json to just /update in the meantime

-Yonik
http://lucidimagination.com


On Mon, May 14, 2012 at 2:42 PM, Rajesh Jain  wrote:
> 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 
> wrote:
>
>> Check the examples of update/json here:
>>
>> 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-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
>> '
>> --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/
>> ?
>>
>> 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--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
>>


Re: Update JSON not working for me

2012-05-14 Thread Rajesh Jain
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 wrote:

> Check the examples of update/json here:
>
> 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-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
> '
> --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/
> ?
>
> 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--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
>


Re: Update JSON not working for me

2012-05-14 Thread Jack Krupansky

Check the examples of update/json here:

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 -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'
--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/?

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 --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