Forum: Ferret Combine ferret with database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0377ec6fab3880beb5da3dde78af5418?d=identicon&s=25 Henrik Zagerholm (cubiq)
on 2007-02-22 19:26
(Received via mailing list)
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
12c7b64bd20d1f48e49a964200bd79e8?d=identicon&s=25 Ryan King (Guest)
on 2007-02-22 20:22
(Received via mailing list)
On 2/22/07, Henrik Zagerholm <henke@mac.se> 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 :D


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
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-02-23 11:09
(Received via mailing list)
Hi!

On Thu, Feb 22, 2007 at 10:38:59AM -0800, Ryan King wrote:
> On 2/22/07, Henrik Zagerholm <henke@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.

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@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
0377ec6fab3880beb5da3dde78af5418?d=identicon&s=25 Henrik Zagerholm (cubiq)
on 2007-02-23 23:27
(Received via mailing list)
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
D12eb3135791d642b4bc46b9d04dc034?d=identicon&s=25 caman (Guest)
on 2007-02-27 05:50
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
0377ec6fab3880beb5da3dde78af5418?d=identicon&s=25 Henrik Zagerholm (cubiq)
on 2007-02-27 13:35
(Received via mailing list)
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:
This topic is locked and can not be replied to.