# Possibly same issue as 'duplicate search results' topic?

**URL:** <https://www.ruby-forum.com/t/possibly-same-issue-as-duplicate-search-results-topic/96501>\
**Category:** Ferret\
**Created:** [June 29, 2006, 2:20am UTC](https://www.ruby-forum.com/t/possibly-same-issue-as-duplicate-search-results-topic/96501 "2006-06-29T02:20:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [June 29, 2006, 2:20am UTC](https://www.ruby-forum.com/t/possibly-same-issue-as-duplicate-search-results-topic/96501/1 "2006-06-29T02:20:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [June 29, 2006, 9:19am UTC](https://www.ruby-forum.com/t/possibly-same-issue-as-duplicate-search-results-topic/96501/2 "2006-06-29T09:19:54Z")

</div>

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](http://www.webit.de)  
Dipl.-Wirtschaftsingenieur Jens Krämer removed\_email\_address@domain.invalid  
Schnorrstraße 76 Tel +49 351 46766 0  
D-01069 Dresden Fax +49 351 46766 66

---

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [June 29, 2006, 3:29pm UTC](https://www.ruby-forum.com/t/possibly-same-issue-as-duplicate-search-results-topic/96501/3 "2006-06-29T15:29:01Z")

</div>

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](http://www.webit.de)  
> Dipl.-Wirtschaftsingenieur Jens Krï¿½mer removed\_email\_address@domain.invalid  
> Schnorrstraï¿½e 76 Tel +49 351 46766 0  
> D-01069 Dresden Fax +49 351 46766 66
