Wolfgang Borgon
2006-Jul-02 20:29 UTC
[Ferret-talk] 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! -- Posted via http://www.ruby-forum.com/.
Jan Prill
2006-Jul-03 07:50 UTC
[Ferret-talk] Multiple terms accross multipl fields and associated tables
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 On 7/2/06, Wolfgang Borgon <wborgon at gmail.com> wrote:> > 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! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20060703/1bb53c58/attachment.html
Jan Prill
2006-Jul-03 07:50 UTC
[Ferret-talk] Multiple terms accross multipl fields and associated tables
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 On 7/2/06, Wolfgang Borgon <wborgon at gmail.com> wrote:> > 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! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20060703/70069850/attachment.html
Wolfgang Borgon
2006-Jul-04 05:12 UTC
[Ferret-talk] Multiple terms accross multipl fields and associated tab
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 Prill 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-- Posted via http://www.ruby-forum.com/.