Sorry, really not sure what could be causing the problem here. Sphinx doesn't like something, but I'm not sure what.
-- Pat On 07/09/2011, at 7:05 PM, aussie-fan wrote: > Hi Pat, > > yes, for a product it's a MVA and for an offer a single integer, but I > get the same result for an offer index definition with the type > declaration: > class Offer > has shop_participation(:shop_id), :as => :shop_id, :type => :multi > end > > Aussie-Fan > > On 6 Sep., 01:25, Pat Allan <[email protected]> wrote: >> Not really sure why this is happening - looks like you're doing everything >> right. >> >> Just to confirm: is the attribute a single id for Offer, but multiple for >> Product? I wonder if Sphinx isn't happy that they're different data types >> (MVA vs single integer). >> >> -- >> Pat >> >> On 05/09/2011, at 6:14 PM, aussie-fan wrote: >> >> >> >> >> >> >> >>> 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 integer attribute. >>> class Product >>> has shop_participations(:shop_id), :as => :shop_id >>> end >> >>> class Offer >>> has shop_participation(:shop_id), :as => :shop_id >>> 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>' >> >>> If I do the search for each model, there's no problem: >>> os = >>> Offer.search(: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") >> >>> ps = >>> Product.search(: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") >> >>> But why? >> >>> Aussie-Fan >> >>> -- >>> 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 >>> athttp://groups.google.com/group/thinking-sphinx?hl=en. > > -- > 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. > -- 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.
