# Issues with searching custom fields

**URL:** <https://www.ruby-forum.com/t/issues-with-searching-custom-fields/104922>\
**Category:** Ferret\
**Created:** [May 23, 2007, 10:08pm UTC](https://www.ruby-forum.com/t/issues-with-searching-custom-fields/104922 "2007-05-23T22:08:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [May 23, 2007, 10:08pm UTC](https://www.ruby-forum.com/t/issues-with-searching-custom-fields/104922/1 "2007-05-23T22:08:15Z")

</div>

Hey all,

I’m using acts\_as\_ferret this way:  
class Job \< ActiveRecord::Base  
acts\_as\_ferret :fields =\> [:title, :workers\_name]

def workers\_name  
return self.workers.inject("") {|names,b| names + " " +  
b.first\_name}.to\_s  
end  
end

But when I do Job.find\_by\_contents(“workers\_name:patrick”)  
I get nil.

Yet when I do:  
j=Job.find :first  
j.workers\_name  
I do get a worker (among others) which name is patrick.

Any idea why I don’t get it with find\_by\_contents?

thanx in advance

Pat

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [May 24, 2007, 11:41am UTC](https://www.ruby-forum.com/t/issues-with-searching-custom-fields/104922/2 "2007-05-24T11:41:59Z")

</div>

On Wed, May 23, 2007 at 10:07:29PM +0200, Patrick A. wrote:

> But when I do Job.find\_by\_contents(“workers\_name:patrick”)  
> I get nil.
> 
> Yet when I do:  
> j=Job.find :first  
> j.workers\_name  
> I do get a worker (among others) which name is patrick.
> 
> Any idea why I don’t get it with find\_by\_contents?

have you tried rebuilding your index? You have to do so after changing  
aaf options.

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  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [May 24, 2007, 3:35pm UTC](https://www.ruby-forum.com/t/issues-with-searching-custom-fields/104922/3 "2007-05-24T15:35:44Z")

</div>

On 5/24/07, Jens K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> have you tried rebuilding your index? You have to do so after changing  
> aaf options.

yes indeed I did rm -rf index/ yesterday and it worked 🙂
