thinking-sphinx的排序


sphinx本身支持datetime、integer、float、string等类型的排序,但是thinking-sphinx在定义索引的时候给人造成的误区简直让人想骂娘!

indexes :accepted_id, :sortable => true

这行是假象,默认是用字符串排序,即使accepted_id 是整型的!

正确写法

 has :accepted_id, :type => :integer

这里声明accepted_id是个属性,支持integer类型的排序和索引!

唉,看文档是王道啊

  1. 还没有评论
(will not be published)

Verify Code   If you cannot see the CheckCode image,please refresh the page again!