Find conditions in more_like_this

Hello.

I’m trying to use acts_as_ferret to index with set conditions.

Ideally I could do something like:

acts_as_ferret :fields => [ :title, :body ],
:conditions => [“enabled = 1”]

But would settle for being able to do:

@similiar_blogs = @blog.more_like_this :field_names => [ :title, :body
], :conditions => “enabled=1”

What is the best way of accomplishing this with using more_like_this, or
even better – applying these conditions to the model to be indexed
globally.

Thanks in advance for any advice or suggestions.

On Fri, Feb 16, 2007 at 07:04:45PM +0100, Jason Hines wrote:

But would settle for being able to do:

@similiar_blogs = @blog.more_like_this :field_names => [ :title, :body
], :conditions => “enabled=1”

What is the best way of accomplishing this with using more_like_this, or
even better – applying these conditions to the model to be indexed
globally.

you could override the ferret_enabled? instance method to only return
true if your condition is met.

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