Hello, I want to know if this is possible with sphinx. Let''s say I have this table. id | user_id | title -------------------- 1 1 sphinx 6 1 sphinx 2 5 sphinx 3 5 sphinx 4 4 server 5 1 great -------------------- I want to group_by(user_id) and say at least 2 times occured in the user_id for that specific title Maybe something like this in Rails: pages = Page.search(''sphinx'', :group_by => ''user_id'', :group_function => :attr, :group_clause => "@users desc") But I want something like this: group_by(user_id) if @at_least_found_to_times In the end I need this result. user_ids | users | title ---------------------------- 1,5 2 sphinx ---------------------------- Hope someone can direct me in any direction :D Thanks for any help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
you can use any function in group_by clause, for example you can write something like your_record_collection.group_by{|zz| function_returning_found_times}.each do |count_of_times, sub_collection| next if count_of_times<SOME_VALUE # user_ids = sub_collection.collect(&:user_id).join('','') users_cnt = sub_collection.size ...etc end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
With Rails or does sphinx handle the calculations all together? Anton Anykeyev wrote in post #968296:> you can use any function in group_by clause, for example you can write > something like > > your_record_collection.group_by{|zz| > function_returning_found_times}.each do |count_of_times, sub_collection| > > next if count_of_times<SOME_VALUE # > user_ids = sub_collection.collect(&:user_id).join('','') > users_cnt = sub_collection.size > > ...etc > > end-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.