Forum: Ferret multi_search problems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tudor (Guest)
on 2007-03-27 20:36
Hello.

I've been trying to get multi_search to work and I simply can't.

I have two models:

Post
acts_as_ferret :fields => [:title, :body], :store_class_name => true

Page
acts_as_ferret :fields => [:title, :body], :store_class_name => true

If I do @results = Post.find_by_contents(params[:q]) or @results =
Page.find_by_contents(params[:q]) it works fine, but if I try to search
in both models @results = Page.multi_search(params[:q],[Post]) I get the
following error:

nil is not a symbol
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:438:in
`const_get'
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:438:in
`multi_search'
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:460:in
`id_multi_search'
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/multi_index.rb:28:in
`search_each'
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/multi_index.rb:28:in
`search_each'
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:457:in
`id_multi_search'
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:437:in
`multi_search'
#{RAILS_ROOT}/app/controllers/site_controller.rb:121:in `search'
-e:3:in `load'
-e:3

The interesting part is that this only happens whenever it also finds a
Page that maches the query. If it only finds Posts there's no errors.
Post is part of a has many through relation so my guess is that this
could something to do with it but don't know what.

The indexes are ok for both models.

I'm using ferret-0.10.9-mswin32 and the latest version of the
acts_as_ferret plugin.

Any help would be greatly appreciated!
Tudor (Guest)
on 2007-03-28 00:30
Right, I realized that I didn't have the latest version installed. I
installed from the svn now and everything seems to be working ok now.
Joy :)
This topic is locked and can not be replied to.