Hi,

I'm a little bit confused.

I try to group by an attribute called 'shop_id' in an application wide
search:
ts = ThinkingSphinx.search(:classes => [Offer,
Product], :match_mode=>:any, :with=>{:showable=>true, :matched_to_product=>[0,
2]}, :ignore_errors=>false, :page=>1, :per_page=>12, :sort_mode=>:extended, 
:order=>"ranking
DESC, @relevance
DESC", :group_by=>"shop_id", :group_function=>:attr, :group_clause=>"@count
desc")

Both models have this attribute.
class Product

end

class Offer

end

But it results in:
ThinkingSphinx::SphinxError: group-by attribute 'shop_id' not found
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/thinking-
sphinx-2.0.5/lib/thinking_sphinx/search.rb:406:in `block in populate'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/thinking-
sphinx-2.0.5/lib/thinking_sphinx/search.rb:551:in `call'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/thinking-
sphinx-2.0.5/lib/thinking_sphinx/search.rb:551:in
`retry_on_stale_index'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/thinking-
sphinx-2.0.5/lib/thinking_sphinx/search.rb:394:in `populate'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/thinking-
sphinx-2.0.5/lib/thinking_sphinx/search.rb:176:in `method_missing'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
railties-3.0.4/lib/rails/commands/console.rb:44:in `start'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
railties-3.0.4/lib/rails/commands/console.rb:8:in `start'
        from /home/sebastian/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
railties-3.0.4/lib/rails/commands.rb:23:in `<top (required)>'
        from script/rails:7:in `require'
        from script/rails:7:in `<main>'

-- 
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.

Reply via email to