开发者

How to add a GROUP_BY clause in a Searchlogic query?

开发者 https://www.devze.com 2023-02-21 05:00 出处:网络
I\'m using Searchlogic with Rails 2.3.5 and I need 开发者_JAVA百科to do add a GROUP_BY clause with 2 columns to my query. I tried:

I'm using Searchlogic with Rails 2.3.5 and I need 开发者_JAVA百科to do add a GROUP_BY clause with 2 columns to my query. I tried:

User.search.group = "column1, column2"     # Undefined method 'group'
User.search(:group => "column1, column2")  # Searchlogic::Search::UnknownConditionError: The group is not a valid condition. You may only use conditions that map to a named scope

And neither worked. I couldn't find any other ways in Searchlogic's docs. Is there any other way?


According to this page: http://vladzloteanu.wordpress.com/2009/01/25/searchlogic-plugin-activerecord-search-on-steroids/

You can probably use:

User.search.conditions.group("column1,column2")
0

精彩评论

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