Debugging Solr search queries on Sunspot

后端 未结 5 1660
陌清茗
陌清茗 2021-01-19 02:06

How can I debug Solr search queries when using the Sunspot gem on Rails? I have some queries that are returning bizarrely high scores, and I\'m trying to get to the bottom

相关标签:
5条回答
  • 2021-01-19 02:38

    When you search from your web app do you search specific fields or just the default field? When you type something into the admin console to debug searches, its easy to forget to tell it which field(s) you want to search on and if you don't tell it then only the default field is searched.

    https://stackoverflow.com/a/8082936/474597 has a better explaination, in which you need to include the search column name such as body_text:your_key_words

    0 讨论(0)
  • 2021-01-19 02:38

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

    0 讨论(0)
  • 2021-01-19 02:53

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

    0 讨论(0)
  • 2021-01-19 02:58

    Try reading Debugging Search Application Relevance Issues which discusses explanations and the Solr analysis tool.

    0 讨论(0)
  • 2021-01-19 03:04

    If setting log_level to FINEST doesn't work, you should add this line to an initializer:

    require "sunspot/rails/solr_logging"
    

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

    0 讨论(0)
提交回复
热议问题