Levent Ali
2007-May-15 15:39 UTC
[Ferret-talk] how to index and search multiple foreign keys in aaf
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
Jens Kraemer
2007-May-15 17:05 UTC
[Ferret-talk] how to index and search multiple foreign keys in aaf
On Tue, May 15, 2007 at 04:39:41PM +0100, Levent Ali wrote:> 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)'')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 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa