Topic: Full Text Search in Rails

I've been fumbling with acts_as_ferret and have been successful searching on model at a time. The creator of the plugin has been pretty helpful, but I still cant get sitewide search working, which makes me wonder if I am trying to do things the hard way.

Anyone else out there doing sitewide, multiple-model searches in Rails?

If you want to point out links to the wiki, please paste the text here as I cant see any of RoR's subdomains (412 errors)

Last edited by pimpmaster (2007-04-17 15:05:24)

Re: Full Text Search in Rails


What exactly are you trying to achieve? I have some experience with AAF (still very little tho).
From my knowledge, there are two different ways to search: actual text search and filters.

find_by_contents comes with 3 options: query, options and find_options
[code ruby]Model.find_by_contents(q, options = {}, find_options = {}) [/code]
find_options are particularly interesting if you want to filter things out that can not be achieved by a string search, such as evaluating numbers, e.g. :conditions => "income < 1000".

The find_options also help to establish associations via the :include option to other models. However, I'd use these things only if they really make sense, because AAF first processes the full text search and then applies the filters (which is kinda strange imo).

If you read through the class_methods.rb file in the AAF plugin folder it may help to find out what you try to achieve.

Hope this helps.

Re: Full Text Search in Rails

I have managed to get find_by_content working perfectly. My problems really only happen when I try to use multi_search so I can return results from multiple models. I get all sorts of nil errors.. You can see my problem and the responses of Jens Kraemer (AAF's creator) here: … 03080.html

As you can see, Jens really went out of his way to help me, but I still have had no success with multi_search. I have talked to a few other posters with the same problems, who have moved on to acts_as_solr as an alternative. (Something I am considering at this point)

Re: Full Text Search in Rails

When I started with Ferret I ran into some challenging problems myself. Mainly to get it working on a shared host without having the ferret gem installed. I've been reading about Solr, too. I did not follow it up, however, as I got ferret working for my needs.

If there's an easy way to get Solr running, that would be nice. Perhaps you could post your experienced here in case you switch to Solr after all :-)