【问题标题】:Better Thinking Sphinx Results更好的思考狮身人面像结果
【发布时间】:2013-05-03 11:51:04
【问题描述】:

我最近开始使用thinking sphinx gem,并且在运行搜索方面取得了巨大成功,但是我注意到由于某种原因,某些搜索没有返回正确的记录。

config/thinking_sphinx.yml

development:
  mysql41: 3313
  morphology: stem_en

indicies/product_index.rb

indexes :title

lib/tasks/my_rake_task.rake

term = "Garmin Edge 500 GPS Enabled Computer"
@product = Product.search Riddle::Query.escape(term), ranker: :none 

rake 任务应与“Garmin Edge 500 GPS 自行车计算机”数据库中的标题匹配,但由于某种原因,它返回一个空数组。当我删除“启用”一词时,它会返回记录。

我只是想知道是否有一种简单的方法可以提高搜索的准确性?

【问题讨论】:

    标签: ruby-on-rails ruby sphinx thinking-sphinx


    【解决方案1】:

    嗨,保罗(刚刚回复了 TS 列表,但这是我的回复,并附有示例):

    你想要做的(匹配一些但不一定是所有的词)有点棘手,但这里有几点需要注意:

    如果您想匹配 任何 个单词,而不是全部,您可以在每个单词之间插入 |(| 是 Sphinx 的 OR)。还有 quorum 运算符,但这可能更难,因为您无法控制用户可以输入多少个术语。 http://sphinxsearch.com/docs/current.html#extended-syntax

    # Using ORs
    Product.search "Garmin | Edge | 500 | GPS | Enabled | Computer"
    # Using quorum
    Product.search '"Garmin Edge 500 GPS Enabled Computer"/4'
    

    无论哪种方式,您都会对用户提供的查询进行切片以计算或拆分单词,这有点烦人,但也许值得。

    希望这会有所帮助。

    【讨论】:

    • 嗨,帕特,这确实给了我一些看点。有了你给出的两个例子,我现在得到了结果,所以通过进一步的工作,我相信我可以进一步过滤这个列表。
    猜你喜欢
    • 1970-01-01
    • 2017-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多