Forum: Ferret issues with searching custom fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Patrick A. (Guest)
on 2007-05-24 00:08
(Received via mailing list)
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
Jens K. (Guest)
on 2007-05-24 13:41
(Received via mailing list)
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

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
Patrick A. (Guest)
on 2007-05-24 17:35
(Received via mailing list)
On 5/24/07, Jens K. <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 :)
This topic is locked and can not be replied to.