vanng822 / go-solr

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

logging #42

Closed gadelkareem closed 6 years ago

gadelkareem commented 6 years ago

Good Job! How to get debug info for the raw query sent to solr?

vanng822 commented 6 years ago

Hi @gadelkareem Unfortunately there is no logging from this package. What is your use-case? Can't you see the query from solr logging? Solr logs a lot of useful stuffs already.

It is possible to set flag Debug to true on the "search" object. This will construct solr to return the search query. It's long time ago I used solr so I don't remember if it is raw or parsed query.

This package is really thin so it is not doing anything special. What you add into the query (as bellow) it will send to solr + format/wt json and basic auth.

query := solr.NewQuery() query.Q("*:*") s := si.Search(query) You can more or less inspect this query and see. That was my thought

gadelkareem commented 6 years ago

I thought there is a hook that I can use to log the raw query on the fly but your suggestion is fine too, thanks.

vanng822 commented 6 years ago

btw did you figure out what you could do? should we close this ticket?

gadelkareem commented 6 years ago

Oh yeah I did the logging in the repository of the model and it was enough. I will close this.