go-solr icon indicating copy to clipboard operation
go-solr copied to clipboard

Handle user-specific requests that are not already handled

Open gadelkareem opened this issue 6 years ago • 2 comments

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..
	}

gadelkareem avatar Jan 26 '19 01:01 gadelkareem

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 avatar Feb 18 '20 17:02 vanng822

@vanng822 yes as I mentioned in the example above the /suggest endpoint is not covered by the library yet.

gadelkareem avatar Feb 23 '20 13:02 gadelkareem