【发布时间】: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