Re: Error in indexing JSON with space in value

2018-03-22 Thread Zheng Lin Edwin Yeo
Thanks for the input.

I have got this to work by using cygwin.

Regards,
Edwin

On 23 March 2018 at 07:04, Chris Hostetter  wrote:

> :
> : Ah, there's the extra bit of context:
> : > PS C:\curl> .\curl '
> :
> : You're using Windows perhaps?  If so, it's probably a shell issue
> : getting all of the data to the "curl" command.
>
> Yep.. and you cna even see in the trace output that curl thinks the entire
> JSON payload you want to send is 24 bytes long, and ends with '"Joe'...
>
> : > 0090: 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 json..Content-Le
> : > 00a0: 6e 67 74 68 3a 20 32 34 0d 0a 0d 0a ngth: 24
> : > => Send data, 24 bytes (0x18)
> : > : 20 7b 20 20 20 69 64 3a 31 2c 20 20 20 6e 61 6d  {   id:1,   nam
> : > 0010: 65 5f 73 3a 20 4a 6f 65 e_s: Joe
> : > == Info: upload completely sent off: 24 out of 24 bytes
>
>
> -Hoss
> http://www.lucidworks.com/
>


Re: Error in indexing JSON with space in value

2018-03-22 Thread Zheng Lin Edwin Yeo
Yes, I'm running this on Windows, using Windows Powershell "curl" command.

Will try out other tools like cygwin.

Thanks you.

Regards,
Edwin


On 23 March 2018 at 06:52, Yonik Seeley  wrote:

> Ah, there's the extra bit of context:
> > PS C:\curl> .\curl '
>
> You're using Windows perhaps?  If so, it's probably a shell issue
> getting all of the data to the "curl" command.
> Something like cygwin or WSL (Windows Subsystem for Linux) may make
> your life easier.
>
> -Yonik
>
> PS C:\curl> .\curl 'http://localhost:8983/solr/co
> llection1/update/json/docs?split=/|/orgs
> '
>  -H 'Content-type:application/j
> son' -d ' {   "id":"1",   "name_s": "Joe Smith",   "phone_s": 876876687,
>  "orgs": [ {   "name1_s": "Microsoft",
>"city_s": "Seattle",   "zip_s": 98052}, {   "name1_s":
> "Apple",   "city_s": "Cupertino",   "z
> ip_s": 95014}   ] }' --trace -
>
> == Info:   Trying ::1...
> == Info: TCP_NODELAY set
> == Info: Connected to localhost (::1) port 8983 (#0)
> => Send header, 172 bytes (0xac)
> : 50 4f 53 54 20 2f 65 64 6d 2f 65 6d 61 69 6c 73 POST /edm/emails
> 0010: 36 2f 75 70 64 61 74 65 2f 6a 73 6f 6e 2f 64 6f 6/update/json/do
> 0020: 63 73 3f 73 70 6c 69 74 3d 2f 7c 2f 6f 72 67 73 cs?split=/|/orgs
> 0030: 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a  HTTP/1.1..Host:
> 0040: 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 39 38 33 0d  localhost:8983.
> 0050: 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 .User-Agent: cur
> 0060: 6c 2f 37 2e 35 32 2e 31 0d 0a 41 63 63 65 70 74 l/7.52.1.
> .Accept
> 0070: 3a 20 2a 2f 2a 0d 0a 43 6f 6e 74 65 6e 74 2d 74 : */*..Content-t
> 0080: 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f ype:application/
> 0090: 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 json..Content-Le
> 00a0: 6e 67 74 68 3a 20 32 34 0d 0a 0d 0a ngth: 24
> => Send data, 24 bytes (0x18)
> : 20 7b 20 20 20 69 64 3a 31 2c 20 20 20 6e 61 6d  {   id:1,   nam
> 0010: 65 5f 73 3a 20 4a 6f 65 e_s: Joe
> == Info: upload completely sent off: 24 out of 24 bytes
> <= Recv header, 26 bytes (0x1a)
> : 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 HTTP/1.1 400 Bad
> 0010: 20 52 65 71 75 65 73 74 0d 0aRequest..
> <= Recv header, 40 bytes (0x28)
> : 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
> 0010: 78 74 2f 70 6c 61 69 6e 3b 63 68 61 72 73 65 74 xt/plain;charset
> 0020: 3d 75 74 66 2d 38 0d 0a =utf-8..
> <= Recv header, 21 bytes (0x15)
> : 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length:
> 0010: 33 32 33 0d 0a  323..
> <= Recv header, 2 bytes (0x2)
> : 0d 0a   ..
> <= Recv data, 323 bytes (0x143)
> : 7b 0a 20 20 22 72 65 73 70 6f 6e 73 65 48 65 61 {.  "responseHea
> 0010: 64 65 72 22 3a 7b 0a 20 20 20 20 22 73 74 61 74 der":{."stat
> 0020: 75 73 22 3a 34 30 30 2c 0a 20 20 20 20 22 51 54 us":400,."QT
> 0030: 69 6d 65 22 3a 30 7d 2c 0a 20 20 22 65 72 72 6f ime":0},.  "erro
> 0040: 72 22 3a 7b 0a 20 20 20 20 22 6d 65 74 61 64 61 r":{."metada
> 0050: 74 61 22 3a 5b 0a 20 20 20 20 20 20 22 65 72 72 ta":[.  "err
> 0060: 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e 61 or-class","org.a
> 0070: 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d 6f pache.solr.commo
> 0080: 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e 22 n.SolrException"
> 0090: 2c 0a 20 20 20 20 20 20 22 72 6f 6f 74 2d 65 72 ,.  "root-er
> 00a0: 72 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e ror-class","org.
> 00b0: 61 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d apache.solr.comm
> 00c0: 6f 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e on.SolrException
> 00d0: 22 5d 2c 0a 20 20 20 20 22 6d 73 67 22 3a 22 43 "],."msg":"C
> 00e0: 61 6e 6e 6f 74 20 70 61 72 73 65 20 70 72 6f 76 annot parse prov
> 00f0: 69 64 65 64 20 4a 53 4f 4e 3a 20 45 78 70 65 63 ided JSON: Expec
> 0100: 74 65 64 20 27 2c 27 20 6f 72 20 27 7d 27 3a 20 ted ',' or '}':
> 0110: 63 68 61 72 3d 28 45 4f 46 29 2c 70 6f 73 69 74 char=(EOF),posit
> 0120: 69 6f 6e 3d 32 34 20 41 46 54 45 52 3d 27 27 22 ion=24 AFTER=''"
> 0130: 2c 0a 20 20 20 20 22 63 6f 64 65 22 3a 34 30 30 ,."code":400
> 0140: 7d 7d 0a}}.
> {
>   "responseHeader":{
> "status":400,
> "QTime":0},
>   "error":{
> "metadata":[
>   "error-class","org.apache.solr.common.SolrException",
>   "root-error-class","org.apache.solr.common.SolrException"],
> "msg":"Cannot parse provided JSON: Expected ',' or '}':
> char=(EOF),position=24 AFTER=''",
> "code":400}}
> == Info: Curl_http_done: called premature == 0
> == Info: Connection #0 to host localhost left intact
> curl: (3) [globbing] bad range specification in column 39
>
>
> Regards,
> Edwin
>
>
>


Re: Error in indexing JSON with space in value

2018-03-22 Thread Chris Hostetter
: 
: Ah, there's the extra bit of context:
: > PS C:\curl> .\curl '
: 
: You're using Windows perhaps?  If so, it's probably a shell issue
: getting all of the data to the "curl" command.

Yep.. and you cna even see in the trace output that curl thinks the entire 
JSON payload you want to send is 24 bytes long, and ends with '"Joe'...

: > 0090: 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 json..Content-Le
: > 00a0: 6e 67 74 68 3a 20 32 34 0d 0a 0d 0a ngth: 24
: > => Send data, 24 bytes (0x18)
: > : 20 7b 20 20 20 69 64 3a 31 2c 20 20 20 6e 61 6d  {   id:1,   nam
: > 0010: 65 5f 73 3a 20 4a 6f 65 e_s: Joe
: > == Info: upload completely sent off: 24 out of 24 bytes


-Hoss
http://www.lucidworks.com/


Re: Error in indexing JSON with space in value

2018-03-22 Thread Yonik Seeley
Ah, there's the extra bit of context:
> PS C:\curl> .\curl '

You're using Windows perhaps?  If so, it's probably a shell issue
getting all of the data to the "curl" command.
Something like cygwin or WSL (Windows Subsystem for Linux) may make
your life easier.

-Yonik


On Thu, Mar 22, 2018 at 6:45 PM, Zheng Lin Edwin Yeo
 wrote:
> Thanks for your reply.
>
>
>
> PS C:\curl> .\curl '
> http://localhost:8983/edm/emails6/update/json/docs?split=/|/orgs' -H
> 'Content-type:application/j
> son' -d ' {   "id":"1",   "name_s": "Joe Smith",   "phone_s": 876876687,
>  "orgs": [ {   "name1_s": "Microsoft",
>"city_s": "Seattle",   "zip_s": 98052}, {   "name1_s":
> "Apple",   "city_s": "Cupertino",   "z
> ip_s": 95014}   ] }' --trace -
>
> == Info:   Trying ::1...
> == Info: TCP_NODELAY set
> == Info: Connected to localhost (::1) port 8983 (#0)
> => Send header, 172 bytes (0xac)
> : 50 4f 53 54 20 2f 65 64 6d 2f 65 6d 61 69 6c 73 POST /edm/emails
> 0010: 36 2f 75 70 64 61 74 65 2f 6a 73 6f 6e 2f 64 6f 6/update/json/do
> 0020: 63 73 3f 73 70 6c 69 74 3d 2f 7c 2f 6f 72 67 73 cs?split=/|/orgs
> 0030: 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a  HTTP/1.1..Host:
> 0040: 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 39 38 33 0d  localhost:8983.
> 0050: 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 .User-Agent: cur
> 0060: 6c 2f 37 2e 35 32 2e 31 0d 0a 41 63 63 65 70 74 l/7.52.1..Accept
> 0070: 3a 20 2a 2f 2a 0d 0a 43 6f 6e 74 65 6e 74 2d 74 : */*..Content-t
> 0080: 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f ype:application/
> 0090: 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 json..Content-Le
> 00a0: 6e 67 74 68 3a 20 32 34 0d 0a 0d 0a ngth: 24
> => Send data, 24 bytes (0x18)
> : 20 7b 20 20 20 69 64 3a 31 2c 20 20 20 6e 61 6d  {   id:1,   nam
> 0010: 65 5f 73 3a 20 4a 6f 65 e_s: Joe
> == Info: upload completely sent off: 24 out of 24 bytes
> <= Recv header, 26 bytes (0x1a)
> : 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 HTTP/1.1 400 Bad
> 0010: 20 52 65 71 75 65 73 74 0d 0aRequest..
> <= Recv header, 40 bytes (0x28)
> : 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
> 0010: 78 74 2f 70 6c 61 69 6e 3b 63 68 61 72 73 65 74 xt/plain;charset
> 0020: 3d 75 74 66 2d 38 0d 0a =utf-8..
> <= Recv header, 21 bytes (0x15)
> : 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length:
> 0010: 33 32 33 0d 0a  323..
> <= Recv header, 2 bytes (0x2)
> : 0d 0a   ..
> <= Recv data, 323 bytes (0x143)
> : 7b 0a 20 20 22 72 65 73 70 6f 6e 73 65 48 65 61 {.  "responseHea
> 0010: 64 65 72 22 3a 7b 0a 20 20 20 20 22 73 74 61 74 der":{."stat
> 0020: 75 73 22 3a 34 30 30 2c 0a 20 20 20 20 22 51 54 us":400,."QT
> 0030: 69 6d 65 22 3a 30 7d 2c 0a 20 20 22 65 72 72 6f ime":0},.  "erro
> 0040: 72 22 3a 7b 0a 20 20 20 20 22 6d 65 74 61 64 61 r":{."metada
> 0050: 74 61 22 3a 5b 0a 20 20 20 20 20 20 22 65 72 72 ta":[.  "err
> 0060: 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e 61 or-class","org.a
> 0070: 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d 6f pache.solr.commo
> 0080: 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e 22 n.SolrException"
> 0090: 2c 0a 20 20 20 20 20 20 22 72 6f 6f 74 2d 65 72 ,.  "root-er
> 00a0: 72 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e ror-class","org.
> 00b0: 61 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d apache.solr.comm
> 00c0: 6f 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e on.SolrException
> 00d0: 22 5d 2c 0a 20 20 20 20 22 6d 73 67 22 3a 22 43 "],."msg":"C
> 00e0: 61 6e 6e 6f 74 20 70 61 72 73 65 20 70 72 6f 76 annot parse prov
> 00f0: 69 64 65 64 20 4a 53 4f 4e 3a 20 45 78 70 65 63 ided JSON: Expec
> 0100: 74 65 64 20 27 2c 27 20 6f 72 20 27 7d 27 3a 20 ted ',' or '}':
> 0110: 63 68 61 72 3d 28 45 4f 46 29 2c 70 6f 73 69 74 char=(EOF),posit
> 0120: 69 6f 6e 3d 32 34 20 41 46 54 45 52 3d 27 27 22 ion=24 AFTER=''"
> 0130: 2c 0a 20 20 20 20 22 63 6f 64 65 22 3a 34 30 30 ,."code":400
> 0140: 7d 7d 0a}}.
> {
>   "responseHeader":{
> "status":400,
> "QTime":0},
>   "error":{
> "metadata":[
>   "error-class","org.apache.solr.common.SolrException",
>   "root-error-class","org.apache.solr.common.SolrException"],
> "msg":"Cannot parse provided JSON: Expected ',' or '}':
> char=(EOF),position=24 AFTER=''",
> "code":400}}
> == Info: Curl_http_done: called premature == 0
> == Info: Connection #0 to host localhost left intact
> curl: (3) [globbing] bad range specification in column 39
>
> Regards,
> Edwin
>
> On 23 March 2018 at 03:49, Yonik Seeley  wrote:
>
>> It looks like a curl globbing issue from the curl error message you
>> included:
>> "curl: (3) [globbing] bad range specification in column 39"
>>
>> You can try turning off curl globbing with 

Re: Error in indexing JSON with space in value

2018-03-22 Thread Zheng Lin Edwin Yeo
 Thanks for your reply.

This is the curl command that I run, with the "--trace -" output.


PS C:\curl> .\curl 'http://localhost:8983/solr/collection1/update/json/docs?
split=/|/orgs
'
 -H 'Content-type:application/j
son' -d ' {   "id":"1",   "name_s": "Joe Smith",   "phone_s": 876876687,
 "orgs": [ {   "name1_s": "Microsoft",
   "city_s": "Seattle",   "zip_s": 98052}, {   "name1_s":
"Apple",   "city_s": "Cupertino",   "z
ip_s": 95014}   ] }' --trace -

== Info:   Trying ::1...
== Info: TCP_NODELAY set
== Info: Connected to localhost (::1) port 8983 (#0)
=> Send header, 172 bytes (0xac)
: 50 4f 53 54 20 2f 65 64 6d 2f 65 6d 61 69 6c 73 POST /edm/emails
0010: 36 2f 75 70 64 61 74 65 2f 6a 73 6f 6e 2f 64 6f 6/update/json/do
0020: 63 73 3f 73 70 6c 69 74 3d 2f 7c 2f 6f 72 67 73 cs?split=/|/orgs
0030: 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a  HTTP/1.1..Host:
0040: 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 39 38 33 0d  localhost:8983.
0050: 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 .User-Agent: cur
0060: 6c 2f 37 2e 35 32 2e 31 0d 0a 41 63 63 65 70 74 l/7.52.1.
.Accept
0070: 3a 20 2a 2f 2a 0d 0a 43 6f 6e 74 65 6e 74 2d 74 : */*..Content-t
0080: 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f ype:application/
0090: 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 json..Content-Le
00a0: 6e 67 74 68 3a 20 32 34 0d 0a 0d 0a ngth: 24
=> Send data, 24 bytes (0x18)
: 20 7b 20 20 20 69 64 3a 31 2c 20 20 20 6e 61 6d  {   id:1,   nam
0010: 65 5f 73 3a 20 4a 6f 65 e_s: Joe
== Info: upload completely sent off: 24 out of 24 bytes
<= Recv header, 26 bytes (0x1a)
: 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 HTTP/1.1 400 Bad
0010: 20 52 65 71 75 65 73 74 0d 0aRequest..
<= Recv header, 40 bytes (0x28)
: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
0010: 78 74 2f 70 6c 61 69 6e 3b 63 68 61 72 73 65 74 xt/plain;charset
0020: 3d 75 74 66 2d 38 0d 0a =utf-8..
<= Recv header, 21 bytes (0x15)
: 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length:
0010: 33 32 33 0d 0a  323..
<= Recv header, 2 bytes (0x2)
: 0d 0a   ..
<= Recv data, 323 bytes (0x143)
: 7b 0a 20 20 22 72 65 73 70 6f 6e 73 65 48 65 61 {.  "responseHea
0010: 64 65 72 22 3a 7b 0a 20 20 20 20 22 73 74 61 74 der":{."stat
0020: 75 73 22 3a 34 30 30 2c 0a 20 20 20 20 22 51 54 us":400,."QT
0030: 69 6d 65 22 3a 30 7d 2c 0a 20 20 22 65 72 72 6f ime":0},.  "erro
0040: 72 22 3a 7b 0a 20 20 20 20 22 6d 65 74 61 64 61 r":{."metada
0050: 74 61 22 3a 5b 0a 20 20 20 20 20 20 22 65 72 72 ta":[.  "err
0060: 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e 61 or-class","org.a
0070: 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d 6f pache.solr.commo
0080: 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e 22 n.SolrException"
0090: 2c 0a 20 20 20 20 20 20 22 72 6f 6f 74 2d 65 72 ,.  "root-er
00a0: 72 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e ror-class","org.
00b0: 61 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d apache.solr.comm
00c0: 6f 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e on.SolrException
00d0: 22 5d 2c 0a 20 20 20 20 22 6d 73 67 22 3a 22 43 "],."msg":"C
00e0: 61 6e 6e 6f 74 20 70 61 72 73 65 20 70 72 6f 76 annot parse prov
00f0: 69 64 65 64 20 4a 53 4f 4e 3a 20 45 78 70 65 63 ided JSON: Expec
0100: 74 65 64 20 27 2c 27 20 6f 72 20 27 7d 27 3a 20 ted ',' or '}':
0110: 63 68 61 72 3d 28 45 4f 46 29 2c 70 6f 73 69 74 char=(EOF),posit
0120: 69 6f 6e 3d 32 34 20 41 46 54 45 52 3d 27 27 22 ion=24 AFTER=''"
0130: 2c 0a 20 20 20 20 22 63 6f 64 65 22 3a 34 30 30 ,."code":400
0140: 7d 7d 0a}}.
{
  "responseHeader":{
"status":400,
"QTime":0},
  "error":{
"metadata":[
  "error-class","org.apache.solr.common.SolrException",
  "root-error-class","org.apache.solr.common.SolrException"],
"msg":"Cannot parse provided JSON: Expected ',' or '}':
char=(EOF),position=24 AFTER=''",
"code":400}}
== Info: Curl_http_done: called premature == 0
== Info: Connection #0 to host localhost left intact
curl: (3) [globbing] bad range specification in column 39


Regards,
Edwin


On 23 March 2018 at 06:45, Zheng Lin Edwin Yeo  wrote:

> Thanks for your reply.
>
>
>
> PS C:\curl> .\curl 'http://localhost:8983/edm/emails6/update/json/docs?
> split=/|/orgs' -H 'Content-type:application/j
> son' -d ' {   "id":"1",   "name_s": "Joe Smith",   "phone_s": 876876687,
>  "orgs": [ {   "name1_s": "Microsoft",
>"city_s": "Seattle",   "zip_s": 98052}, {   "name1_s":
> "Apple",   "city_s": "Cupertino",   "z
> ip_s": 95014}   ] }' --trace -
>
> == Info:   Trying ::1...
> == Info: TCP_NODELAY set
> == Info: Connected to localhost (::1) port 8983 

Re: Error in indexing JSON with space in value

2018-03-22 Thread Zheng Lin Edwin Yeo
Thanks for your reply.



PS C:\curl> .\curl '
http://localhost:8983/edm/emails6/update/json/docs?split=/|/orgs' -H
'Content-type:application/j
son' -d ' {   "id":"1",   "name_s": "Joe Smith",   "phone_s": 876876687,
 "orgs": [ {   "name1_s": "Microsoft",
   "city_s": "Seattle",   "zip_s": 98052}, {   "name1_s":
"Apple",   "city_s": "Cupertino",   "z
ip_s": 95014}   ] }' --trace -

== Info:   Trying ::1...
== Info: TCP_NODELAY set
== Info: Connected to localhost (::1) port 8983 (#0)
=> Send header, 172 bytes (0xac)
: 50 4f 53 54 20 2f 65 64 6d 2f 65 6d 61 69 6c 73 POST /edm/emails
0010: 36 2f 75 70 64 61 74 65 2f 6a 73 6f 6e 2f 64 6f 6/update/json/do
0020: 63 73 3f 73 70 6c 69 74 3d 2f 7c 2f 6f 72 67 73 cs?split=/|/orgs
0030: 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a  HTTP/1.1..Host:
0040: 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 39 38 33 0d  localhost:8983.
0050: 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 .User-Agent: cur
0060: 6c 2f 37 2e 35 32 2e 31 0d 0a 41 63 63 65 70 74 l/7.52.1..Accept
0070: 3a 20 2a 2f 2a 0d 0a 43 6f 6e 74 65 6e 74 2d 74 : */*..Content-t
0080: 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f ype:application/
0090: 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 json..Content-Le
00a0: 6e 67 74 68 3a 20 32 34 0d 0a 0d 0a ngth: 24
=> Send data, 24 bytes (0x18)
: 20 7b 20 20 20 69 64 3a 31 2c 20 20 20 6e 61 6d  {   id:1,   nam
0010: 65 5f 73 3a 20 4a 6f 65 e_s: Joe
== Info: upload completely sent off: 24 out of 24 bytes
<= Recv header, 26 bytes (0x1a)
: 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 HTTP/1.1 400 Bad
0010: 20 52 65 71 75 65 73 74 0d 0aRequest..
<= Recv header, 40 bytes (0x28)
: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
0010: 78 74 2f 70 6c 61 69 6e 3b 63 68 61 72 73 65 74 xt/plain;charset
0020: 3d 75 74 66 2d 38 0d 0a =utf-8..
<= Recv header, 21 bytes (0x15)
: 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length:
0010: 33 32 33 0d 0a  323..
<= Recv header, 2 bytes (0x2)
: 0d 0a   ..
<= Recv data, 323 bytes (0x143)
: 7b 0a 20 20 22 72 65 73 70 6f 6e 73 65 48 65 61 {.  "responseHea
0010: 64 65 72 22 3a 7b 0a 20 20 20 20 22 73 74 61 74 der":{."stat
0020: 75 73 22 3a 34 30 30 2c 0a 20 20 20 20 22 51 54 us":400,."QT
0030: 69 6d 65 22 3a 30 7d 2c 0a 20 20 22 65 72 72 6f ime":0},.  "erro
0040: 72 22 3a 7b 0a 20 20 20 20 22 6d 65 74 61 64 61 r":{."metada
0050: 74 61 22 3a 5b 0a 20 20 20 20 20 20 22 65 72 72 ta":[.  "err
0060: 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e 61 or-class","org.a
0070: 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d 6f pache.solr.commo
0080: 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e 22 n.SolrException"
0090: 2c 0a 20 20 20 20 20 20 22 72 6f 6f 74 2d 65 72 ,.  "root-er
00a0: 72 6f 72 2d 63 6c 61 73 73 22 2c 22 6f 72 67 2e ror-class","org.
00b0: 61 70 61 63 68 65 2e 73 6f 6c 72 2e 63 6f 6d 6d apache.solr.comm
00c0: 6f 6e 2e 53 6f 6c 72 45 78 63 65 70 74 69 6f 6e on.SolrException
00d0: 22 5d 2c 0a 20 20 20 20 22 6d 73 67 22 3a 22 43 "],."msg":"C
00e0: 61 6e 6e 6f 74 20 70 61 72 73 65 20 70 72 6f 76 annot parse prov
00f0: 69 64 65 64 20 4a 53 4f 4e 3a 20 45 78 70 65 63 ided JSON: Expec
0100: 74 65 64 20 27 2c 27 20 6f 72 20 27 7d 27 3a 20 ted ',' or '}':
0110: 63 68 61 72 3d 28 45 4f 46 29 2c 70 6f 73 69 74 char=(EOF),posit
0120: 69 6f 6e 3d 32 34 20 41 46 54 45 52 3d 27 27 22 ion=24 AFTER=''"
0130: 2c 0a 20 20 20 20 22 63 6f 64 65 22 3a 34 30 30 ,."code":400
0140: 7d 7d 0a}}.
{
  "responseHeader":{
"status":400,
"QTime":0},
  "error":{
"metadata":[
  "error-class","org.apache.solr.common.SolrException",
  "root-error-class","org.apache.solr.common.SolrException"],
"msg":"Cannot parse provided JSON: Expected ',' or '}':
char=(EOF),position=24 AFTER=''",
"code":400}}
== Info: Curl_http_done: called premature == 0
== Info: Connection #0 to host localhost left intact
curl: (3) [globbing] bad range specification in column 39

Regards,
Edwin

On 23 March 2018 at 03:49, Yonik Seeley  wrote:

> It looks like a curl globbing issue from the curl error message you
> included:
> "curl: (3) [globbing] bad range specification in column 39"
>
> You can try turning off curl globbing with the -g param.
> That may not be the only issue though, as the command shown shouldn't
> have triggered curl globbing.  Perhaps you simplified it or redacted
> some info before posting?
>
> -Yonik
>


Re: Error in indexing JSON with space in value

2018-03-22 Thread Yonik Seeley
It looks like a curl globbing issue from the curl error message you included:
"curl: (3) [globbing] bad range specification in column 39"

You can try turning off curl globbing with the -g param.
That may not be the only issue though, as the command shown shouldn't
have triggered curl globbing.  Perhaps you simplified it or redacted
some info before posting?

-Yonik


Re: Error in indexing JSON with space in value

2018-03-22 Thread Shawn Heisey
On 3/22/2018 9:48 AM, Zheng Lin Edwin Yeo wrote:
> I am trying to index the following JSON, in which there is a space in the
> name "Joe Smith".
>
> .\curl 'http://localhost:8983/solr/collection/update/json/docs?split=/|/orgs
> '
> -H 'Content-type:application/json' -d '
> {
>   "id":"1",
>   "name_s": "Joe Smith",
>   "phone_s": 876876687,
>   "orgs": [
> {
>   "name1_s" : "Microsoft",
>   "city_s" : "Seattle",
>   "zip_s" : 98052},
> {
>   "name1_s" : "Apple",
>   "city_s" : "Cupertino",
>   "zip_s" : 95014}
>   ]
> }'
>
> However, I get the following error during the indexing.
>
> {
>   "responseHeader":{
> "status":400,
> "QTime":1},
>   "error":{
> "metadata":[
>   "error-class","org.apache.solr.common.SolrException",
>   "root-error-class","org.apache.solr.common.SolrException"],
> "msg":"Cannot parse provided JSON: Expected ',' or '}':
> char=(EOF),position=24 AFTER=''",
> "code":400}}
> curl: (3) [globbing] bad range specification in column 39

The error here is complaining about the format of the JSON itself, not
the content.  That space should not be causing ANY problems.

I suspect that there's something bad about the curl command you're
doing, or maybe a bug in the system you're trying it on, but I cannot be
sure.  If we could see a graphical screenshot of the window/screen where
you're entering the curl command, that might be helpful.

By changing ONLY field names (because my index doesn't have any of the
field names you're using), adding a required field for my index to each
section, and making sure I did everything right on the curl command, I
was able to get this to work with JSON that's substantially similar to
yours, including an unchanged "Joe Smith" value:

===
[root@westgate ~]# curl
'http://bigindy5.REDACTED.com:8982/solr/s0build/update/json/docs?split=/|/orgs'
-H 'Content-type:application/json' -d '
{
  "tag_id":"1",
  "keywords": "Joe Smith",
  "did": 876876687,
  "orgs": [
    {
  "tag_id" : "2",
  "did": 176876687,
  "mood" : "Microsoft",
  "special_cats" : "Seattle",
  "byline" : 98052},
    {
  "tag_id" : "3",
  "did": 276876687,
  "mood" : "Apple",
  "special_cats" : "Cupertino",
  "byline" : 95014}
  ]
}'
{"responseHeader":{"status":0,"QTime":6}}
===

This request indexed 3 docs.

The server that I'm sending to is running version 6.6.2.

Thanks,
Shawn



Re: Error in indexing JSON with space in value

2018-03-22 Thread Chris Hostetter


I can't reproduce the problem you described -- using 7.2.1 and the 
techproducts example i can index a JSON string w/white space just fine...

$ bin/solr -e techproducts
$ curl 'http://localhost:8983/solr/techproducts/update/json/docs' -H 
'Content-type:application/json' -d '
{
  "id":"1",
  "name_s": "Joe Smith",
  "phone_s": 876876687}'
{
  "responseHeader":{
"status":0,
"QTime":5}}

Your specific curl command had some oddities in it (".\" before "curl";
"-H" on a new line w/o "\" escaping the newline) that may have just been
artifacts of copy/paste into email...

But even when trying to run the command as i think you intended it, i did 
not get a JSON parsing error regarding space -- just a nested doc error 
because your "split" param wasn't compatible with the configured default 
"srcField" option in the techproducts configset...

$ curl 
'http://localhost:8983/solr/techproducts/update/json/docs?srcField==/|/orgs'
 -H 'Content-type:application/json' -d '
{
  "id":"1",
  "name_s": "Joe Smith",
  "phone_s": 876876687,
  "orgs": [
{
  "name1_s" : "Microsoft",
  "city_s" : "Seattle",
  "zip_s" : 98052},
{
  "name1_s" : "Apple",
  "city_s" : "Cupertino",
  "zip_s" : 95014}
  ]
}'
{
  "responseHeader":{
"status":400,
"QTime":2},
  "error":{
"metadata":[
  "error-class","org.apache.solr.common.SolrException",
  "root-error-class","org.apache.solr.common.SolrException"],
"msg":"Raw data can be stored only if split=/",
"code":400}}




Are you *certain* it was a plain old space character, and that you didn't 
somehow get an EOF character or NUL byte in there some how?

Can you try running your curl command with the '--trace -' option and send 
us the full output?





: Date: Thu, 22 Mar 2018 23:48:21 +0800
: From: Zheng Lin Edwin Yeo 
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Error in indexing JSON with space in value
: 
: Hi,
: 
: I am trying to index the following JSON, in which there is a space in the
: name "Joe Smith".
: 
: .\curl 'http://localhost:8983/solr/collection/update/json/docs?split=/|/orgs
: '
: -H 'Content-type:application/json' -d '
: {
:   "id":"1",
:   "name_s": "Joe Smith",
:   "phone_s": 876876687,
:   "orgs": [
: {
:   "name1_s" : "Microsoft",
:   "city_s" : "Seattle",
:   "zip_s" : 98052},
: {
:   "name1_s" : "Apple",
:   "city_s" : "Cupertino",
:   "zip_s" : 95014}
:   ]
: }'
: 
: However, I get the following error during the indexing.
: 
: {
:   "responseHeader":{
: "status":400,
: "QTime":1},
:   "error":{
: "metadata":[
:   "error-class","org.apache.solr.common.SolrException",
:   "root-error-class","org.apache.solr.common.SolrException"],
: "msg":"Cannot parse provided JSON: Expected ',' or '}':
: char=(EOF),position=24 AFTER=''",
: "code":400}}
: curl: (3) [globbing] bad range specification in column 39
: 
: 
: If I remove the space in "Joe Smith" to make it "JoeSmith", then the
: indexing is successful. What can we do if we want to keep the space in the
: name? Do we need to include some escape characters or something?
: 
: I'm using Solr 7.2.1.
: 
: Regards,
: Edwin
: 

-Hoss
http://www.lucidworks.com/


Error in indexing JSON with space in value

2018-03-22 Thread Zheng Lin Edwin Yeo
Hi,

I am trying to index the following JSON, in which there is a space in the
name "Joe Smith".

.\curl 'http://localhost:8983/solr/collection/update/json/docs?split=/|/orgs
'
-H 'Content-type:application/json' -d '
{
  "id":"1",
  "name_s": "Joe Smith",
  "phone_s": 876876687,
  "orgs": [
{
  "name1_s" : "Microsoft",
  "city_s" : "Seattle",
  "zip_s" : 98052},
{
  "name1_s" : "Apple",
  "city_s" : "Cupertino",
  "zip_s" : 95014}
  ]
}'

However, I get the following error during the indexing.

{
  "responseHeader":{
"status":400,
"QTime":1},
  "error":{
"metadata":[
  "error-class","org.apache.solr.common.SolrException",
  "root-error-class","org.apache.solr.common.SolrException"],
"msg":"Cannot parse provided JSON: Expected ',' or '}':
char=(EOF),position=24 AFTER=''",
"code":400}}
curl: (3) [globbing] bad range specification in column 39


If I remove the space in "Joe Smith" to make it "JoeSmith", then the
indexing is successful. What can we do if we want to keep the space in the
name? Do we need to include some escape characters or something?

I'm using Solr 7.2.1.

Regards,
Edwin