On 10/9/06, bbqTree <[EMAIL PROTECTED]> wrote:
> 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.

Personally I don't use acts_as_ferret but I'll try and answer these
questions as best I can. The following will automatically index the
fields of the Foo model:

 class Foo < ActiveRecord::Base
   acts_as_ferret
 end

See http://projects.jkraemer.net/acts_as_ferret/wiki/AdvancedUsage for
more advanced usage.

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

That above link is the most complete tutorial I know of. Maybe someone
else will know of other resources. If you need to do anything more
advanced then you should probably learn more about Ferret itself.

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

Ferret is pretty easy to experiment with. Here is an example:

    require 'rubygems'
    require 'ferret'

    index = Ferret::I.new

    [
      "island bbq style plate",
      "bbq ribs",
      "potato plate salad",
      "my bbq plate"
    ].each {|text| index << text}

    puts index.search('bbq plate')
    puts index.search('"bbq plate"')

And the output:

    TopDocs: total_hits = 4, max_score = 0.883883 [
            3 "my bbq plate": 0.883883
            0 "island bbq style plate": 0.707107
            1 "bbq ribs": 0.220971
            2 "potato plate salad": 0.176777
    ]
    TopDocs: total_hits = 1, max_score = 1.250000 [
            3 "my bbq plate": 1.250000
    ]

So to answer your question, yes, the results are ordered by relevency.


> Thanks for the help!

no problem.

Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to