vanng822 / go-solr

Solr client in Go, core admin, add docs, update, delete, search and more
MIT License
69 stars 42 forks source link

Panic on interface convertion #50

Open gwan284 opened 5 years ago

gwan284 commented 5 years ago
interface conversion: interface {} is nil, not map[string]interface {}:
panic(0x2423640, 0xc0168b8930)
    C:/Go/src/runtime/panic.go:513 +0x1c7
github.com/vanng822/go-solr/solr.(*StandardResultParser).Parse(0x3410718, 0xc07f1360e0, 0x6, 0xc015d9cf38, 0xc07f1360e0)
    C:/Users/Margaryta/GoSrc/src/bitbucket.org/repustate/repustate-go/src/github.com/vanng822/go-solr/solr/parser.go:130 +0x6a5
github.com/vanng822/go-solr/solr.(*Search).Result(0xc032187710, 0x0, 0x0, 0x0, 0x1, 0xc04ed9c0b0)
    C:/Users/Margaryta/GoSrc/src/bitbucket.org/repustate/repustate-go/src/github.com/vanng822/go-solr/solr/search.go:72 +0xbe

Happens when Solr fails to load core to execute solr.Search , in such cases Solr instance returns error object like :

  "error":{
    "metadata":[
      "error-class","org.apache.solr.core.SolrCoreInitializationException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"SolrCore 'clientindices' is not available due to init failure: Could not load configuration from directory /var/solr/data/configsets/_default",
    "trace":"org.apache.solr.core.SolrCoreInitializationException: SolrCore 'clientindices' is not available due to init failure: Could not load configuration from directory /var/solr/data/configsets/_default\n\tat org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:1593)\n\tat org.apache.solr.servlet.HttpSolrCall.init(HttpSolrCall.java:249)\n\tat .
...
org.apache.solr.servlet.HttpSolrCall.handleAdmin(HttpSolrCall.java:734)\n\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:496)\n\t... 36 more\n",
    "code":500}}
chadwcarlson commented 5 years ago

@gwan284 Just came across this same issue. Find a solution?

gwan284 commented 5 years ago

@chadwcarlson workarounded by checking core status via STATUS command before executing search.

chadwcarlson commented 5 years ago

@gwan284 Is this something that can be done using SolrInterface or it requires a CoreAdmin?

gwan284 commented 5 years ago

It requires CoreAdmin (see STATUS command): https://lucene.apache.org/solr/guide/6_6/coreadmin-api.html

If your client might not have such access level, just fork this lib and fix locally, because this repo seems to be not maintained any longer.

vanng822 commented 5 years ago

Sorry for not responding It sounds like you need a better release process and monitoring tool to make sure things are up and running.