太阳黑子:按属性排序/排序构面结果,例如created_at
资产模型:
searchable do
text :title
text :description
time :created_at
integer :category_ids, :multiple => true, :references => Category
end
控制器:
search = Asset.search() do
keywords(h(params[:query]), :fields => [:title, :description])
facet(:category_ids)
order_by :created_at
end
我不想通过 :count
(点击次数)对我的方面 :Category_ides
进行排序。类别应按 created_at
排序。查看文档facet(:category_ids, :sort
=> :count || :index
),这两个选项都不适合我。
如何解决构面的顺序问题?
Asset model:
searchable do
text :title
text :description
time :created_at
integer :category_ids, :multiple => true, :references => Category
end
Controller:
search = Asset.search() do
keywords(h(params[:query]), :fields => [:title, :description])
facet(:category_ids)
order_by :created_at
end
I would not like to sort my facet :Category_ides
via :count
(number of hits). The categories should be ordered by created_at
. Looking at the documentation facet(:category_ids, :sort
=> :count || :index
), both options won't work for me.
How can I solve this order problem for facets?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以只加载方面,然后自己对它们进行排序:
You can just load the facets and then sort them yourself: