Multi_search problems, Never go away!

Hello, I am trying to use the multi_search method, but I keep getting
type error on nil objects, I send it [Model1,Model2] and it seems as
though the class names keep getting clobbered and turn to nil, somewhere
along the multi_index area. I tried to trace what was going on, but I
got nothing, also, this only happens when there are actually hits(thank
god, most of the time). Perhaps some insight? Thank you!

Jens K. wrote:

Hi!

On Mon, Oct 09, 2006 at 10:35:00AM +0200, wc wrote:

Hello, I am trying to use the multi_search method, but I keep getting
type error on nil objects, I send it [Model1,Model2] and it seems as
though the class names keep getting clobbered and turn to nil, somewhere
along the multi_index area. I tried to trace what was going on, but I
got nothing, also, this only happens when there are actually hits(thank
god, most of the time). Perhaps some insight? Thank you!

a stack trace and / or some code would help in tracking this down…

Jens


webit! Gesellschaft f�r neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Kr�mer [email protected]
Schnorrstra�e 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Here is the trace
User.multi_search(“foo”,[Model1,Model2])
TypeError: nil is not a symbol
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:412:in
const_get' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:412:inmulti_search’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:431:in
id_multi_search' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/multi_index.rb:27:insearch_each’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:428:in
id_multi_search' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:411:inmulti_search’
from (irb):1

both my models call:

acts_as_ferret :store_class_name => true

and that is basically it, find_by_contents works great, just not
multi_search

Hope this helps

~wil

On Mon, Oct 09, 2006 at 11:31:47PM +0200, wc wrote:
[…]

Here is the trace
User.multi_search(“foo”,[Model1,Model2])
TypeError: nil is not a symbol
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:412:in
`const_get’

it seems your indexes don’t contain the class_name field for all your
indexed objects.

both my models call:

acts_as_ferret :store_class_name => true

you should have all three models (User, Model1 and Model2) using the
:store_class_name option.

Then, after rebuilding your indexes, multi_search should work fine.

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Jens K. wrote:

On Mon, Oct 09, 2006 at 11:31:47PM +0200, wc wrote:
[…]

Here is the trace
User.multi_search(“foo”,[Model1,Model2])
TypeError: nil is not a symbol
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:412:in
`const_get’

it seems your indexes don’t contain the class_name field for all your
indexed objects.

both my models call:

acts_as_ferret :store_class_name => true

you should have all three models (User, Model1 and Model2) using the
:store_class_name option.

Then, after rebuilding your indexes, multi_search should work fine.

Jens


webit! Gesellschaft f�r neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Kr�mer [email protected]
Schnorrstra�e 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

I have :store_class_name => true in all the models, and I search using
model1.multi_search(“foo”,[Model1,Model2]) it works so long as there are
no matches, but if there are matches I get the same error I previously
posted about the nil object. I checked my indexes and they are create as
well, for all the models I need to search

wc wrote:

Jens K. wrote:

On Mon, Oct 09, 2006 at 11:31:47PM +0200, wc wrote:
[…]

Here is the trace
User.multi_search(“foo”,[Model1,Model2])
TypeError: nil is not a symbol
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:412:in
`const_get’

it seems your indexes don’t contain the class_name field for all your
indexed objects.

both my models call:

acts_as_ferret :store_class_name => true

you should have all three models (User, Model1 and Model2) using the
:store_class_name option.

Then, after rebuilding your indexes, multi_search should work fine.

Jens


webit! Gesellschaft f�r neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Kr�mer [email protected]
Schnorrstra�e 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

I have :store_class_name => true in all the models, and I search using
model1.multi_search(“foo”,[Model1,Model2]) it works so long as there are
no matches, but if there are matches I get the same error I previously
posted about the nil object. I checked my indexes and they are create as
well, for all the models I need to search

I also just upgraded to Ferret 0.10.11 and I am using acts_as_ferret
latest stable

thanks

~wil

So it seems as though :model => doc[:class_name] line 428 of
class_methods.rb isn’t doing what it’s supposed to, I checked the
indexes and there is in fact a class_name field being created from the
acts_as_ferret :store_class_name => true, I just dont know why it isn’t
being used and turns to nil in this case, again only if there is a hit
is it nil

Hi!

On Mon, Oct 09, 2006 at 10:35:00AM +0200, wc wrote:

Hello, I am trying to use the multi_search method, but I keep getting
type error on nil objects, I send it [Model1,Model2] and it seems as
though the class names keep getting clobbered and turn to nil, somewhere
along the multi_index area. I tried to trace what was going on, but I
got nothing, also, this only happens when there are actually hits(thank
god, most of the time). Perhaps some insight? Thank you!

a stack trace and / or some code would help in tracking this down…

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

wc wrote:

So it seems as though :model => doc[:class_name] line 428 of
class_methods.rb isn’t doing what it’s supposed to, I checked the
indexes and there is in fact a class_name field being created from the
acts_as_ferret :store_class_name => true, I just dont know why it isn’t
being used and turns to nil in this case, again only if there is a hit
is it nil

I’m starting to think it might have something to do with one of my
models being a HABTM relationship setup

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs