You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
following code snippet is used to construct a valid json string.
func StoreInSolr(sc *solr.SolrInterface, docs []string) (*solr.SolrUpdateResponse, error) {
params := &url.Values{}
params.Add("commit", "true")
var lines []string
for _, doc := range docs {
if len(strings.TrimSpace(doc)) == 0 {
continue
}
lines = append(lines, doc)
}
data := fmt.Sprintf("[%s]\n", strings.Join(lines, ","))
fmt.Printf("data: %+v\n", data)
resp, err := sc.Update(data, params)
return resp, err
}
both resp and err indicate success:
&solr.SolrUpdateResponse{Success:true, Result:map[string]interface {}{"responseHeader":map[string]interface {}{"QTime":3, "status":0}}}, err: <nil>
but on solr debug logs i get
o.a.s.h.l.JsonLoader Can't have a value here. Unexpected STRING at [1]
This has to do with json string format but json is valid.
any pointers appreciated .
The text was updated successfully, but these errors were encountered:
msonawane
changed the title
how to go about inserting []jsonDocs ( Update() returns success but solr logs show failure )s)
how to go about inserting []jsonDocs ( Update() returns success but solr logs show failures)
Feb 28, 2020
Hi @msonawane
It is long time ago I use Solr. I use responseHeader.status as success indicator and can not answer why solr return 0 instead of 400. Don't know if any other here can answer that question? else more likely you can find the answer at Solr-project itself.
Do you have entire response from Solr?
How come that you have it as string already?
I already have json docs as string
following code snippet is used to construct a valid json string.
but on solr debug logs i get
o.a.s.h.l.JsonLoader Can't have a value here. Unexpected STRING at [1]
This has to do with json string format but json is valid.
any pointers appreciated .
The text was updated successfully, but these errors were encountered: