我的广告模型中包含以下属性:
has sort_by_date, :as => :timestamp, :sortable => true
在广告表中有一个sort_by_date字段,它是一个日期时间字段。
但是,当我搜索时,将以下内容作为我的:订单选项(我希望先显示较新的广告,然后按相关性排序)
:order => "sort_by_date DESC, @weight DESC"
我收到以下错误:
ThinkingSphinx::SphinxError (index ad_core: sort-by attribute 'sort_by_date' not found):
有人能看出为什么会发生这种情况吗?
谢谢!
答案 0 :(得分:0)
好的,所以我通过将数据库中的sort_by_date字段从日期时间更改为时间戳来实现此功能,希望这可以帮助其他人。