Acts_as_ferret to search partial phrases and fuzzy

Hi All,

I was wondering if anyone had experience of extending AAF plugin for
Rails to implement a broader query ?

The documentation and the demo provided on the wiki seems to only match
full text queries, or partial when using a * wildcard.

Ideally, I am trying to acheive something similar to the following
(pseudo code):

def search
@query = params[:query] || ‘’
unless @query.blank?
@results = Content.find_by_contents @query
if @results.empty?
@results = Content.partial_word_search @query
if @results.empty?
@results = Content.fuzzy_word_search @query

I realise I could probably achieve something like this by changing to
meet my needs, but I quite like the indexing elegance provided with AAF,
and don’t want to have to reinvent the wheel.

If anyone has experience or pointers that would be great!

Apologies for posting on the ferret list for a rails-ish problem, but
searching the archives seemed to show most of the questions end up here!


Hi Paul!

By default, aaf uses the stock Ferret QueryParser to parse queries
handed to find_by_contents. You have the full power of the Ferret Query
Language, including fuzzy search and friends.

However, if you give find_by_contents a Query object, this query will be
taken as is.

So the easiest way to use aaf with custom queries would be to build
queries outside aaf and use them with find_by_contents.

Does this already solve your problem ?


On Tue, Aug 08, 2006 at 01:32:00PM +0200, Paul W. wrote:

(pseudo code):
Apologies for posting on the ferret list for a rails-ish problem, but
[email protected]

webit! Gesellschaft für neue Medien mbH
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66