After further investigation it seems not to be possible to count the
attributes of an object when doing the full-text search (group-by just
seems to be a solution for the other way around).
The other problem that it does not seem to be possible to use symbols
with "group_by" still remains. I'll open an issue.

On Nov 28, 10:56 am, medihack <[email protected]> wrote:
> Hello.
>
> I have a model named Entity that is associated (has_many) with a model
> Property.
> In Entity I define (define_index):
> has properties(:entity_id), :as => :property
>
> When I know do (after reconfiguration, rebuilding index and so on)
> e = Entity.search :group_by => :property, :group_function => :attr
> then I get the below exception.
>
> This is already described in a post a year 
> ago:http://www.mail-archive.com/[email protected]/msg00968...
> It should actually be fixed (see last message there of Pat), but it
> seems to be still a problem in the current rails3 branch.
>
> When using
> e = Entity.search :group_by => :property, :group_function => :attr
> it runs without an exception, but I get incorrect results.
> I am sure that each Entity has more than one property, but when doing
> a
> e.each_with_groupby_and_count { |post, group, count| puts count }
> it tells me "1" for earch entity.
>
> Do I use the group_by somehow wrong?
>
> The exception I mentioned:
> NoMethodError: undefined method `bytesize' for :property_id:Symbol
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/riddle-1.2.1/
> lib/riddle/client/message.rb:21:in `send'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/riddle-1.2.1/
> lib/riddle/client/message.rb:21:in `append_string'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/riddle-1.2.1/
> lib/riddle/client.rb:663:in `query_message'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/riddle-1.2.1/
> lib/riddle/client.rb:326:in `query'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:357:in
> `populate'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> activesupport-3.0.3/lib/active_support/notifications.rb:52:in
> `instrument'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:
> 21:in `instrument'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> activesupport-3.0.3/lib/active_support/notifications.rb:52:in
> `instrument'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:423:in
> `log'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:431:in
> `log'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:356:in
> `populate'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:470:in
> `call'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:470:in
> `retry_on_stale_index'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:354:in
> `populate'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/bundler/gems/
> thinking-sphinx-822854aeaa0a/lib/thinking_sphinx/search.rb:142:in
> `method_missing'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> awesome_print-0.3.1/lib/ap/awesome_print.rb:56:in `awesome_array'
> ... 2 levels...
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> awesome_print-0.3.1/lib/ap/core_ext/kernel.rb:10:in `send'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> awesome_print-0.3.1/lib/ap/core_ext/kernel.rb:10:in `ai'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> awesome_print-0.3.1/lib/ap/core_ext/kernel.rb:15:in `ap'
>         from /home/kai/.irbrc:18:in `output_value'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:159:in
> `eval_input'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:271:in
> `signal_status'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:155:in
> `eval_input'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:154:in
> `eval_input'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:71:in
> `start'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:70:in
> `catch'
>         from /home/kai/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb.rb:70:in
> `start'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
>         from /home/kai/.rvm/gems/ruby-1.8.7-p...@myproject/gems/
> railties-3.0.3/lib/rails/commands.rb:23
>         from script/rails:8:in `require'

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