0

I have have the meeting model which belongs to the project:

class Project < ActiveRecord::Base
  has_many :meetings
end

class Meeting < ActiveRecord::Base
  belongs_to :project

  define_index do
    join project

    indexes agenda
    indexes project.name. :as => :project_name
  end 
end

I attempt to search with grouping:

Meeting.search("stuff", :group_by => 'project_id', :group_function => :attr)

I get the following error:

group-by attribute 'project_id' not found

Any suggestions?

Many Thanks.

alexs333
  • 12,143
  • 11
  • 51
  • 89

1 Answers1

1

This is just a wild guess based on the examples in the ThinkingSphinx docs (http://freelancing-god.github.com/ts/en/searching.html#grouping), but perhaps you need to include the attribute to be grouped by in the indexing.

Try adding has project_id to your define_index.

MrTheWalrus
  • 9,670
  • 2
  • 42
  • 66