Acts_as_ferret questions? anyone here have experience

*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
    read.

  2. 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.

  3. 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?

Thanks for the help!

Some answers inline,

On 10/9/06, bbqTree [email protected] wrote:

  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
    read.

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…
http://projects.jkraemer.net/acts_as_ferret/rdoc/

  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:

From

http://ferret.davebalmain.com/api/classes/Ferret/QueryParser.html

‘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:
offset:first hit to retrieve (useful for paging) limit: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
SearchResultshttp://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/SearchResults.htmlinstance,
which really is an Array that has been decorated with a
total_hitshttp://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000014accessor
that delivers the total number of hits (including those not fetched
because of a low num_docs value).

[Source]http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#

Thanks for the help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs