On Sun, Aug 06, 2006 at 07:07:39PM +0200, Ian Zabel wrote:
> Is it possible with acts_as_ferret to somehow restrict the results that 
> are returned?
> 
> For instance, I don't want to return results that are logically deleted 
> with acts_as_paranoid (deleted_at IS NOT NULL and deleted_at < now()). 
> Also, if a user is not an Admin, they should not be able to return 
> results that have a certain value in a certain column, like forum_id != 
> 13 (if 13 is an admin only forum).
> 
> What's the best way to accomplish this? Do I need to include the 
> deleted_id and forum_id columns in my index, and then pass in the 
> appropriate search terms in the controller?

If you don't want to filter results _after_ getting them from
acts_as_ferret, including the information needed to filter search results 
in the index is necessary.

You could then use custom built queries to constrain searches beyond
the query terms given by the user. Another way to achieve this are query
filters, which can enhance speed in case of repeated searches with the
same filter criteria.

Jens


-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to