Multiple terms accross multipl fields and associated tables

I’m looking for a good way to search a few fields accross multiple
asociated tables (i.e. find ‘friends and family’ accross Photo.name,
Photo.description, and Tags.name where Photo has_many tags). And,
ideally there’s a competent query analyzer/parser.

I’ve expirimented with constructing my own SQL using … LIKE %term1%
… etc, but the performance is poor – queries take seconds or more
depending on the number of terms.

Will acts_as_ferret work for me? Any recommendations?
Thanks!

Hi Wolfgang,

at least ferret will work perfectly well for you.

Let your photo-model ‘acts_as_ferret’ and make acts_as_ferret index a
method
named eg ‘all_tags’ which returns a comma (or tab or whatever) seperated
string of your tags on this photo. Now you’ll be able to constructs a
query
as described in the rdocs of the QueryParser of ferret that includes
your
tags and should be very performant.

Cheers,
Jan

Hi Wolfgang,

at least ferret will work perfectly well for you.

Let your photo-model ‘acts_as_ferret’ and make acts_as_ferret index a
method
named eg ‘all_tags’ which returns a comma (or tab or whatever) seperated
string of your tags on this photo. Now you’ll be able to constructs a
query
as described in the rdocs of the QueryParser of ferret that includes
your
tags and should be very performant.

Cheers,
Jan

Jan,
Thanks a lot…I saw a blog posting recommending the same thing after I
posted… it works like a charm. I like it and far faster and
confidence-inspiring than mysql LIKE.

For anyone else that sees this, the blog post I saw is:
http://olivier.liquid-concept.ch/articles/2006/04/17/add-tags-in-a-ferret-index

W

Jan P. wrote:

Hi Wolfgang,

at least ferret will work perfectly well for you.

Let your photo-model ‘acts_as_ferret’ and make acts_as_ferret index a
method
named eg ‘all_tags’ which returns a comma (or tab or whatever) seperated
string of your tags on this photo. Now you’ll be able to constructs a
query
as described in the rdocs of the QueryParser of ferret that includes
your
tags and should be very performant.

Cheers,
Jan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs