Some answers inline,
On 10/9/06, bbqTree
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> *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.
You don''t need to index the id column of your AR-Model manually. AAF
will
take care of this automagically...
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.
don''t know. But the api docs of AAF should get you started...
http://projects.jkraemer.net/acts_as_ferret/rdoc/
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?
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
SearchResults<http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/SearchResults.html>instance,
which really is an Array that has been decorated with a
total_hits<http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000014>accessor
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!>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---