思考Sphinx未知标识符groupby
我试图根据文档http://pat.github.io/thinking-sphinx/searching.html#grouping使用Thinking Sphinx搜索with group_by选项:
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
我正在使用思考-sphinx-3.1.1。
group_by选项使用的正确方法是什么?
听起来你正在使用Sphinx 2.0.x – Thinking Sphinx v3.1.x默认使用Sphinx 2.1.x. 但您可以将其配置为以Sphinx 2.0.x所期望的方式运行。