lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cassandra Targett (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SOLR-10424) /update/docs/json is swallowing all fields
Date Thu, 04 Jan 2018 21:10:01 GMT

     [ https://issues.apache.org/jira/browse/SOLR-10424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Cassandra Targett updated SOLR-10424:
-------------------------------------
    Component/s: update

> /update/docs/json is swallowing all fields
> ------------------------------------------
>
>                 Key: SOLR-10424
>                 URL: https://issues.apache.org/jira/browse/SOLR-10424
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: update
>    Affects Versions: 6.5, 7.0
>            Reporter: Hoss Man
>
> I'm not sure when/how exactly this broke, but sending a list of documents to {{/update/json/docs}}
is currently useless -- regardless of what your documents contain, all you get is 3 fields:
{{id}}, {{\_version\_}}, and a {{\_src\_}} field containing your original JSON, but none of
the fields you specified are added.
> Steps to reproduce...
> {noformat}
> git co releases/lucene-solr/6.5.0
> ...
> ant clean && cd solr && ant server
> ...
> bin/solr -e techproducts
> ...
> curl 'http://localhost:8983/solr/techproducts/update/json/docs?commit=true' --data-binary
@example/exampledocs/books.json -H 'Content-type:application/json'
> ...
> curl 'http://localhost:8983/solr/techproducts/query?q=id:978-1933988177'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":5,
>     "params":{
>       "q":"id:978-1933988177"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"978-1933988177",
>         "_src_":"{\n    \"id\" : \"978-1933988177\",\n    \"cat\" : [\"book\",\"paperback\"],\n
   \"name\" : \"Lucene in Action, Second Edition\",\n    \"author\" : \"Michael McCandless\",\n
   \"sequence_i\" : 1,\n    \"genre_s\" : \"IT\",\n    \"inStock\" : true,\n    \"price\"
: 30.50,\n    \"pages_i\" : 475\n  }",
>         "_version_":1563794703530328065}]
>   }}
> {noformat}
> Compare with using {{/update/json}} ...
> {noformat}
> curl 'http://localhost:8983/solr/techproducts/update/json?commit=true' --data-binary
@example/exampledocs/books.json -H 'Content-type:application/json'
> ...
> curl 'http://localhost:8983/solr/techproducts/query?q=id:978-1933988177'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":0,
>     "params":{
>       "q":"id:978-1933988177"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"978-1933988177",
>         "cat":["book",
>           "paperback"],
>         "name":"Lucene in Action, Second Edition",
>         "author":"Michael McCandless",
>         "author_s":"Michael McCandless",
>         "sequence_i":1,
>         "sequence_pi":1,
>         "genre_s":"IT",
>         "inStock":true,
>         "price":30.5,
>         "price_c":"30.5,USD",
>         "pages_i":475,
>         "pages_pi":475,
>         "_version_":1563794766373584896}]
>   }}
> {noformat}
> According to the ref-guide, the only diff between these two endpoints should be that
{{/update/json/docs}} defaults {{json.command=false}} ... but since the top level JSON structure
in books.json is a list ({{"[ ... ]"}}) that shouldn't matter because that's not the solr
JSON command syntax.
> ----
> If you try to send a singular JSON document tp {{/update/json/docs}}, you get the same
problem...
> {noformat}
> curl -X POST -H 'Content-type:application/json' --data-binary '{"id":"HOSS","popularity":42}'
'http://localhost:8983/solr/techproducts/update/json/docs?commit=true'
> ...
> curl 'http://localhost:8983/solr/techproducts/query?q=id:HOSS'{
>   "responseHeader":{
>     "status":0,
>     "QTime":0,
>     "params":{
>       "q":"id:HOSS"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"HOSS",
>         "_src_":"{\"id\":\"HOSS\",\"popularity\":42}",
>         "_version_":1563795188162232320}]
>   }}
> {noformat}
> ...even though the same JSON works fine to {{/update/json?json.command=false}} ...
> {noformat}
> curl -X POST -H 'Content-type:application/json' --data-binary '{"id":"HOSS","popularity":42}'
'http://localhost:8983/solr/techproducts/update/json?commit=true&json.command=false'
> ...
> curl 'http://localhost:8983/solr/techproducts/query?q=id:HOSS'{
>   "responseHeader":{
>     "status":0,
>     "QTime":1,
>     "params":{
>       "q":"id:HOSS"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"HOSS",
>         "popularity":42,
>         "_version_":1563795262581768192}]
>   }}
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message