Debug Solr search queries on Sunspot

How can I debug Solr searches using the Sunspot gem in Rails? I have some queries that return strangely high scores, and I'm trying to figure out why this is happening.

It seems that no debugging information is being displayed in Sunspot, so I believe I need to debug through Solr directly. Fortunately, Solr has a convenient web interface for searching, but for some reason, any queries I return there return with 0 results.

For example, when I search for the word “test” in my web application, it returns a lot of hits. When I look for the same thing in the Solr admin interface, this is what I get:

<response>
  <lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">172</int>
    <lst name="params">
      <str name="explainOther"/>
      <str name="fl">*,score</str>
      <str name="indent">on</str>
      <str name="start">0</str>
      <str name="q">test</str>
      <str name="hl.fl"/>
      <str name="qt">standard</str>
      <str name="wt">standard</str>
      <str name="fq"/>
      <str name="version">2.2</str>
      <str name="rows">10</str>
    </lst>
  </lst>
  <result name="response" numFound="0" start="0" maxScore="0.0"/>
</response> 
+5
5

- ? - , , () , , .

fooobar.com/questions/1054057/... , , body_text:your_key_words

+2

log_level FINEST , :

require "sunspot/rails/solr_logging"

: http://outoftime.github.com/2010/03/03/sunspot-1-0.html

+3

Try reading Debugging Search Relevance Issues , which discusses Solr explanations and analysis tools.

+1
source

To debug requests sent to Solr, I often use an http request analyzer, such as tcpmon or fiddler .

+1
source

Set the log level to FINEST and you will see the exact request in the log file.

+1
source

All Articles