sunspot icon indicating copy to clipboard operation
sunspot copied to clipboard

Sunspot should provide access to debugQuery output to help analyze relevancy

Open nz opened this issue 14 years ago • 2 comments

It would be nice if we could access the debugQuery output without having to check the logs for search parameters and run searches against Solr manually.

nz avatar Oct 06 '11 15:10 nz

I did this and it worked for me:

search = self.solr_search do fulltext term adjust_solr_params { |params| params['debugQuery'] ='on' } end

then, to get access to this information, I did

results[:debug] = search.instance_variable_get(:@solr_result)['debug']

it's ugly, i know, but i have an "unless" there so that this code only runs in dev and only if explicitly requested.

abkonsta avatar Dec 06 '11 16:12 abkonsta

How do you get the score out of that big hash ? search.instance_variable_get(:@solr_result)['debug']['explain']['User 51'] gave me a huge string which is hard to read. is there any way to know why this particular result came first and what is the relevancy score?

sreeharikmarar avatar Nov 19 '12 13:11 sreeharikmarar