Hi!
On Fri, Jun 01, 2007 at 11:00:24PM +0200, Starburger wrote:
> Hi all,
>
> I want to use acts_as_ferret's multi_search to search two model classes
> (Reviewable and Blog) at a time like
>
> @results = Reviewable.multi_search("jemen", [Blog])
>
> and I'm always getting the error
>
> You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.map
>
[..]
> I have configured indexing like this:
>
> acts_as_ferret :fields => [:index_text, :index_locations], :single_index
> => true
> acts_as_ferret :fields => [:index_text, :index_locations], :single_index
> => true
>
> Maybe I'm doing something wrong?
just don't use multi_search with :single_index => true. In the
single_index case, you tell find_by_contents what additional models to
search with the :models option:
@results = Reviewable.find_by_contents("jemen", :models => [Blog])
or
@results = Reviewable.find_by_contents("jemen", :models => :all)
this indeed looks a bit like an inconsistent API, however it's this way
because in the single_index case you have only one Ferret index (hence
find_by_contents is used), while multi_search runs a combined search
across multiple Ferret indexes.
Maybe in a future version I'll integrate the multi_search functionality
into find_by_contents, too.
Jens
--
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk