acts_as_ferret

Do not use this unless you particularly need AAF 0.4.3. This is a fixed version of AAF 0.4.3 to work without warnings on Rails 2.3.10.

This ActiveRecord mixin adds full text search capabilities to any Rails model.

It is heavily based on the original acts_as_ferret plugin done by Kasper Weibel and a modified version done by Thomas Lockney, which both can be found on ferret.davebalmain.com/trac/wiki/FerretOnRails

Installation

System-wide installation with Rubygems

sudo gem install sdsykes_acts_as_ferret

To use acts_as_ferret in your project, add the following line to your project’s config/environment.rb:

gem 'sdsykes_acts_as_ferret' require 'acts_as_ferret'

Call the aaf_install script inside your project directory to install the sample config file and the drb server start/stop script.

Usage

include the following in your model class (specifiying the fields you want to get indexed):

acts_as_ferret :fields => [ :title, :description ]

now you can use ModelClass.find_by_contents(query) to find instances of your model whose indexed fields match a given query. All query terms are required by default, but explicit OR queries are possible. This differs from the ferret default, but imho is the more often needed/expected behaviour (more query terms result in less results).

Please see ActsAsFerret::ActMethods#acts_as_ferret for more information.

License

Released under the MIT license.

Authors

  • Kasper Weibel Nielsen-Refs (original author)

  • Jens Kraemer <[email protected]> (current maintainer)