lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: Error in indexing JSON with space in value
Date Thu, 22 Mar 2018 17:59:35 GMT
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


Mime
View raw message