Thinking Sphinx unknown identifier groupby

瘦欲@ 提交于 2019-12-11 09:25:59

问题


I am trying to use Thinking Sphinx search with group_by option according to documentation http://pat.github.io/thinking-sphinx/searching.html#grouping :

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

But this code generates incorrect Sphinx Query

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

which raises error:

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

I am using thinking-sphinx-3.1.1.

What is the correct way of group_by option usage?


回答1:


It sounds like you're using Sphinx 2.0.x - Thinking Sphinx v3.1.x expects Sphinx 2.1.x by default. But you can configure it to behave in ways that Sphinx 2.0.x expects.



来源:https://stackoverflow.com/questions/25397577/thinking-sphinx-unknown-identifier-groupby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!