go-solr
go-solr copied to clipboard
Handle user-specific requests that are not already handled
Every time a developer adds a new request handler with a new endpoint will need to create its own parser which is a bit of work. Therefore, I suggest to add such handler to allow developers to painlessly handle non standard requests. While errors and status is already handled by the library. ex:
q := solr.NewQuery()
q.AddParam("suggest.q", query)
q.AddParam("suggest", "true")
q.Rows(0)
s := r.Search(q)
res, err := s.Any("suggest", nil)
if err != nil {
return
}
fmt.Printf("%+v", res.Payload) //we should have everything we need
s1, ok := res.Payload["suggest"].(map[string]interface{})
if ok {
//dig some more..
}
Do you have any use case for this or you just think that people may need it? For me if you are using something special then it is fair that you build something your own. People can call directly to Resource(...) and process the response in the way as they want. That was my thought of Resource
@vanng822 yes as I mentioned in the example above the /suggest endpoint is not covered by the library yet.