处理Sphinx(Coreseek)Query failed: index xxxx: sort-by attribute 'xxxx' not found

Sphinx在使用的时候报错Query failed: index xxxx: sort-by attribute 'xxxx' not found。第一个xxxx是索引的名称,第二个xxxx是字段的名称。

出现这个问题的原因是:在索引中没有查找到要排序检索的字段。

但是奇怪的是明明在创建索引文件的时候添加了这个字段,经过排查之后发现排序和检索用的是同一个字段,会起冲突。

解决方法:

在配置文件中给该字段添加一个别名:举个例子create_time字段

sql_query = SELECT note_id,title,types,status,create_time,create_time as sort_time,FROM notes where (status=200 or status = 800)

ok,搞定!

猜你喜欢

转载自www.cnblogs.com/yuanwanli/p/12907782.html
今日推荐