acts_as_ferret questions? anyone here have experience

Some answers inline,

*sorry for posting here but ferret forum doesnt seem as bz as this one:

hi, ive been reading up on ferret, acts_as_ferret, and other search
plugins for rails.

after reading about ferret, i found out about the acts_as_ferrt plugin.

my first question about acts_as_ferret:

  1. from reading about ferret, do i still need to manually save the IDX
    and add a IDX column field to my model table for acts_as_ferret to work?
    they say that acts_as_ferret handles everything, but i wasnt sure what

exactly does it handle when compared to the ferret tutorials that i

You don’t need to index the id column of your AR-Model manually. AAF will take care of this automagically…

  1. is there a complete tutorial online for acts_as_ferret plugin? so far
    all the blogs that i came across pretty much say the same thing.

don’t know. But the api docs of AAF should get you started…

  1. does acts_as_ferret do this? if i specify acts_as_ferret to index
    just title column in my ‘recipe’ table, and if someone types ‘bbq plate’
    in the search box, will these recipes with the following title match?

“island bbq style plate”
“bbq ribs”
“potato plate salad”
“my bbq plate”

if so, will the one with the most matching text like “my bbq plate” be
listed as #1?

that depends. ferret has a sophisticated query parser. So imho it is up to you how you decide to handle the queries your users type in a box. IMHO you should parse the query string your user enters first. you might parse out usually used things like ‘AND’ and phrases ’ “” ’ and then translate them to the query language of ferret:


'sport:ski AND NOT sport:snowboard OR sport:toboggan'

  'ingredient:chocolate AND ingredient:strawberries AND NOT ingredient:wheat'

You can set the default operator when you create the query parse.

There’s a method find_by_contents in AAF. The api says:

Finds instances by contents. Terms are ANDed by default, can be
circumvented by using OR between terms. options:

first hit to retrieve (useful for paging)
number of hits to retrieve, or :all to retrieve all results
find_options is a hash passed on to active_record’s find when
retrieving the data from db, useful to i.e. prefetch relationships.

this method returns a SearchResults
instance, which really is an Array that has been decorated with a total_hits accessor that delivers the
total number of hits (including those not fetched because of a low num_docs