Possibly same issue as 'duplicate search results' topic?

Unfortunately I’m a newbie to ruby, rails, and acts_as_ferret. Also,
I’m working in code I mostly didn’t write, so I’m kind of unsure of
things. So this may be a dumb question. It also may be the same issue
as the topic ‘Duplicate search results’, but I’m not sure.

When I update column values with ApplicationController’s
update_attribute, I am getting additional ferret index entries rather
than replacing the old one. As a result, searches get hits when you
search on a historical value that is no longer the value of the field.

I assume that I am somehow misusing acts_as_ferret?

My call to add the mixin to the model class looks like this:

acts_as_ferret :store_class_name => true, :fields => [‘id’, ‘code’,
‘description’]

As a test (and a workaround), in acts_as_ferret.rb module
InstanceMethods, I replaced:

alias :ferret_update :ferret_create

with:

def ferret_update
self.ferret_destroy
self.ferret_create
end

This ensures unique indexes for me. But I’m guessing it’s redundant and
something else is not used or working as intended.

Thanks for reading,

Neil

Hi,

On Thu, Jun 29, 2006 at 02:20:47AM +0200, Neil Brandt wrote:

I assume that I am somehow misusing acts_as_ferret?

My call to add the mixin to the model class looks like this:

acts_as_ferret :store_class_name => true, :fields => [‘id’, ‘code’,
‘description’]

you should not name the ‘id’ field in the list of fields, it’s always
added to the index automatically. Probably this will solve your problem.

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

Yes, that’s it. That was easy! Thank you very much.

Neil

Jens K. wrote:

Hi,

On Thu, Jun 29, 2006 at 02:20:47AM +0200, Neil Brandt wrote:

I assume that I am somehow misusing acts_as_ferret?

My call to add the mixin to the model class looks like this:

acts_as_ferret :store_class_name => true, :fields => [‘id’, ‘code’,
‘description’]

you should not name the ‘id’ field in the list of fields, it’s always
added to the index automatically. Probably this will solve your problem.

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

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