根据文档,我尝试使用Thinking Sphinx搜索和group_by选项
http://pat.github.io/thinking-sphinx/searching.html#grouping
:
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选项的正确用法是什么?