How to index and search multiple foreign keys in aaf


#1

Let’s say I have a class Job that has a series of possible locations
that are stored as a sequence of foreign keys

class Job
acts_as_ferret {
:locations => {}
}

def locations
“1,25,23,15”
# ??
end
end

Is that a good way to store the location ids?

How would I search for Jobs in a certain location

Job.find_by_contents(‘locations(25)’)

cheers


#2

On Tue, May 15, 2007 at 04:39:41PM +0100, Levent A. wrote:

# ??

end
end

Is that a good way to store the location ids?

How would I search for Jobs in a certain location

Job.find_by_contents(‘locations(25)’)

I’d say ‘locations:25’ but besides that this looks like it could work.
To be on the safe side do not separate the ids with ‘,’ but with ’ '.

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