Combine ferret with database

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 :smiley:

Cheers,
henrik

On 2/22/07, Henrik Z. [email protected] wrote:

account.

Does anyone have any ideas how to do this easily?

MAybe a cool stored procedure in PGSQL that can utilize the ferret
index :smiley:

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

Hi!

On Thu, Feb 22, 2007 at 10:38:59AM -0800, Ryan K. wrote:

On 2/22/07, Henrik Z. [email protected] 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.

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
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

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 Z. wrote:

23 feb 2007 kl. 11:06 skrev Jens K.:

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

23 feb 2007 kl. 11:06 skrev Jens K.:

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

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: