开发者

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

开发者 https://www.devze.com 2022-12-29 03:37 出处:网络
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?

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

精彩评论

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