I'm trying to do a search with TS in which the results are grouped by an attribute (in the example: category).
A structure like this (doesn't have to be arrays):
[[id: 1, name: this, category: foo] [id: 2, name: this, category: foo]],
[[id:3, name: this, category: bar], [id:4, name: this, category: bar]]
I think I could get the results sorted by the attribute and then go over the results generating the structure I want by the attribute but what I'm trying to see if it's possible is that TS does this for me without having to use rails to go over every result item.
I need this structure to display the result elements categorised by the attribute.
I've tried using GROUP_BY but it returns only 1 element per attribute which makes me think I either don't understand the GROUP_BY or I'm not doing the query right:
Video.search(Search.build_options.merge({:conditions => {:name => "this"}, group_by: :category}))
I'm using the current versions of Sphinx and Thinking Sphinx,