Neil Brandt
2006-Jun-29 00:20 UTC
[Ferret-talk] 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 -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Jun-29 07:18 UTC
[Ferret-talk] Possibly same issue as ''duplicate search results'' topic?
Hi, On Thu, Jun 29, 2006 at 02:20:47AM +0200, Neil Brandt wrote:> 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'']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 kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Neil Brandt
2006-Jun-29 13:29 UTC
[Ferret-talk] Possibly same issue as ''duplicate search results'' topic?
Yes, that''s it. That was easy! Thank you very much. Neil Jens Kraemer 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 kraemer at webit.de > Schnorrstra?e 76 Tel +49 351 46766 0 > D-01069 Dresden Fax +49 351 46766 66-- Posted via http://www.ruby-forum.com/.