On Mon, Jun 25, 2007 at 05:06:39PM +0200, Stephen Heuer wrote: > > > Why don't you just index the email address right along with the Person? > > Do you ever need to find a single EmailAddress object? If not, just > > don't index them in their own index. Instead add a custom field to > > Person's acts_as_ferred statement for the email address value. > > I would index the email address right along with the person, but there > is a multiple association there. I would have to index a whole lot of > other data that I would like to be able to search through: > > has_many :phone_numbers > has_many :addresses > has_many :email_addresses > has_many :enrollments > has_many :facilities_applications > has_many :course_invoices > has_many :refunds > has_many :medications > has_many :instructor_bios > has_one :immunization > has_one :administrator > > put that with the fact that I have over 50 models ( all with many > associations ) in my application of which at least half of need to be > searchable, and that turns into a large task. > > I created a module that helps me generate functions for list views ( > with sorting and searching ) that used mysql fulltext searching, but > when searching through ~100,000 records, it would take the app upwards > of 7 seconds to finish finding results. So I was rewriting it to work > with acts_as_ferret. > > So I would assume that acts_as_ferret multi_search doesn't have the > ability to be told that I only want one type of model even though i want > to search through multiple models (to get associations).
no, as aaf doesn't store relationships between records there's no way to do this. However, given the fact your models all have a :person relationship, you could easily filter your results after running the search. However I wouldn't suggest this, I'd really go for a single Person index having all the information in it. For the has_many relationships - just join the contents of all elements together and put them into a single field. What might ease your work with indexing all the related objects along with the Person is a patch residing in aaf's Trac. Unfortunately I didn't find the time to apply this to trunk yet, but it does exactly what you want - just name the relationships as field names in your :fields list. the corresponding ticket is there: http://projects.jkraemer.net/acts_as_ferret/ticket/96 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 [EMAIL PROTECTED] | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

