【问题标题】:Thinking Sphinx unknown identifier groupbyThinking Sphinx 未知标识符 groupby
【发布时间】:2014-08-20 05:52:14
【问题描述】:

我正在尝试根据文档http://pat.github.io/thinking-sphinx/searching.html#grouping 使用带有 group_by 选项的 Thinking Sphinx 搜索:

Point.search('point', group_by: :tour_id)

但是这段代码生成了不正确的 Sphinx 查询

SELECT *, groupby() as sphinx_internal_group, count(*) as sphinx_internal_count 
FROM `point_core`, `point_delta` 
WHERE MATCH('point') AND `sphinx_deleted` = 0 
GROUP BY `tour_id` LIMIT 0, 20

引发错误:

ThinkingSphinx::ParseError: index point_core,point_delta: 
parse error: unknown identifier 'groupby' (not an attribute, not a function) - 
SELECT *, groupby() as sphinx_internal_group, count(*) as sphinx_internal_count 
FROM `point_core`, `point_delta` WHERE MATCH('point') AND `sphinx_deleted` = 0 
GROUP BY `tour_id` LIMIT 0, 20; SHOW META

我正在使用thinking-sphinx-3.1.1。

group_by选项的正确使用方式是什么?

【问题讨论】:

    标签: ruby-on-rails thinking-sphinx


    【解决方案1】:

    听起来您使用的是 Sphinx 2.0.x - Thinking Sphinx v3.1.x 默认需要 Sphinx 2.1.x。但是您可以configure it 以 Sphinx 2.0.x 所期望的方式行事。

    【讨论】:

    • 是的。老斯芬克斯是万恶之源。我安装的 Sphinx 版本是 Sphinx 2.0.4,目前我已将其升级到 2.1.9。所以,现在它的工作完美。谢谢你拍拍。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多