Hello list, I wonder if someone has some tips on joining a ferret search with a database. I have a rails project using a postgresql backend and I would like to utilize the superb performance of ferret for fulltext searching. The problem is that I have to joined the result with the database as I have some user access rights to different documents to take into account. Does anyone have any ideas how to do this easily? MAybe a cool stored procedure in PGSQL that can utilize the ferret index :D Cheers, henrik
On 2/22/07, Henrik Zagerholm <henke at mac.se> wrote:> > Hello list, > > I wonder if someone has some tips on joining a ferret search with a > database. > > I have a rails project using a postgresql backend and I would like to > utilize the superb performance of ferret for fulltext searching. > The problem is that I have to joined the result with the database as > I have some user access rights to different documents to take into > account. > > Does anyone have any ideas how to do this easily? > > MAybe a cool stored procedure in PGSQL that can utilize the ferret > index :DUse acts_as_ferret [1], then either put the access rights stuff in the index, or post process the results from AAF. -ryan 1. http://projects.jkraemer.net/acts_as_ferret/wiki -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20070222/5d2d58e0/attachment.html
Hi! On Thu, Feb 22, 2007 at 10:38:59AM -0800, Ryan King wrote:> On 2/22/07, Henrik Zagerholm <henke at mac.se> wrote: > > > >Hello list, > > > >I wonder if someone has some tips on joining a ferret search with a > >database.[..]> > > Use acts_as_ferret [1], then either put the access rights stuff in the > index, or post process the results from AAF. > > -ryan > 1. http://projects.jkraemer.net/acts_as_ferret/wikito expand this a bit, with aaf you can combine a ferret query with the usual active record conditions, joins and includes like that: Model.find_by_contents(query, {}, { :conditions => ["... ], :include =>... }) or just use find_id_by_contents to only retrieve id, model class and score for each hit, and build your own AR query from that. cheers, 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
23 feb 2007 kl. 11:06 skrev Jens Kraemer:> Hi! > > On Thu, Feb 22, 2007 at 10:38:59AM -0800, Ryan King wrote: >> On 2/22/07, Henrik Zagerholm <henke at mac.se> wrote: >>> >>> Hello list, >>> >>> I wonder if someone has some tips on joining a ferret search with a >>> database. > [..] >> >> >> Use acts_as_ferret [1], then either put the access rights stuff in >> the >> index, or post process the results from AAF. >> >> -ryan >> 1. http://projects.jkraemer.net/acts_as_ferret/wiki > > to expand this a bit, with aaf you can combine a ferret query with > the usual active record conditions, joins and includes like that: > > Model.find_by_contents(query, {}, { :conditions => > ["... ], :include =>... }) > > or just use find_id_by_contents to only retrieve id, model class and > score for each hit, and build your own AR query from that. >Hmm this is really interesting. It looks like this is exactly what I want. I''ll give it a try and see how it goes. Thanks for the info! Cheers, henrik> cheers, > 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 > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk
Were you able to figure this out? Would you share your approach or code? send me an email to aboxfortheotherstuff at gmail dot com Thanks Henrik Zagerholm wrote:> 23 feb 2007 kl. 11:06 skrev Jens Kraemer: > >>> >> >> Model.find_by_contents(query, {}, { :conditions => >> ["... ], :include =>... }) >> >> or just use find_id_by_contents to only retrieve id, model class and >> score for each hit, and build your own AR query from that. >> > Hmm this is really interesting. It looks like this is exactly what I > want. I''ll give it a try and see how it goes. Thanks for the info! > > Cheers, > henrik-- Posted via http://www.ruby-forum.com/.
Hello again, I haven''t had the time to look at all the details yet. I''ve done some testing on single tables and it works really good. The problem is that I have a really really BIG sql query at the moment which I run through find_by_sql so it will take me some time to get that one working with find_by_contents. I''ll post any progress to this list. Cheers, henrik 27 feb 2007 kl. 05:50 skrev caman:> Were you able to figure this out? > Would you share your approach or code? > send me an email to aboxfortheotherstuff at gmail dot com > Thanks > Henrik Zagerholm wrote: >> 23 feb 2007 kl. 11:06 skrev Jens Kraemer: >> >>>> >>> >>> Model.find_by_contents(query, {}, { :conditions => >>> ["... ], :include =>... }) >>> >>> or just use find_id_by_contents to only retrieve id, model class and >>> score for each hit, and build your own AR query from that. >>> >> Hmm this is really interesting. It looks like this is exactly what I >> want. I''ll give it a try and see how it goes. Thanks for the info! >> >> Cheers, >> henrik > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk