开发者

Thinking Sphinx, complex sorting - how can I combine extended sort with expr sort?

I want to sort by expression, then by some attribute ascending, then by another attribute ascending. Something like this: :order => "(a < some constant) desc, b asc, c asc". How to get it?

Extended sorting refuses to work because of <. Expr fails because of commas.

I have managed to produce sorting equivalent to :order => "(a < some constant) desc, b desc" wit开发者_如何转开发h :order => "(a < some constant)", :sort_mode => :expr, :sort_by => :b, but I can't add another attribute (c) to that sorting nor change sorting mode for b to asc.


SetSelect function allows for creating arbitrary sorts. I am not sure if it is available in thinking-sphinx, so modification of this gem may be necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜