Sunspot should provide access to debugQuery output to help analyze relevancy
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.
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.
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?