Hi there
Is there a way I can group my results by multiple attributes? I have
many records that contain the same data in a few fields and need to
collapse them into one record. Am I right in thinking the :group_by
option in the search method only allows one attribute to be specified?
I have tried :group_by => 'field_one, field_two' but I then get zero
results from the search. I am also specifying the group_function as
attr and a group_clause as results within the group need to be
ordered:
Product Model:
define_index do
indexes title
has "CRC32(format)", :as => :num_format, :type => :integer
has "CRC32(title)", :as => :num_title, :type => :integer
has "COUNT(DISTINCT suppliers.id)", :as => :supplier_count, :type
=> :integer
end
@products = Product.search(
:conditions => {:title => params[:q]},
:page => params[:page] || 1,
:index => 'product_core', #I have another index in the
same model
:group_by => 'num_format',
#would like to say :group_by => 'num_title, num_format',
:group_function => :attr,
:group_clause => "supplier_count desc"
)
Is there something else I should be doing?
Any suggestions welcome!
Many thanks
Shaun
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.