Impressum / Imprint

acts_as_ferret 0.4.3

Posted on November 18, 2007

Long time since the last release (not counting the short-lived 0.4.2 …), and I guess most people already use trunk anyway, but for the faint of heart, here’s the new stable version of your favourite Rails fulltext search plugin.

As always, get it via svn from svn://projects.jkraemer.net/acts_as_ferret/tags/stable/acts_as_ferret. More installation information can be found on the acts_as_ferret Trac site.

No big news feature-wise, I already wrote about the more important features when I added them to trunk:

Going through the timeline looking for some cool feature I didn’t already write about I found several smaller things worth mentioning:

Dynamic document specific boosts

This comes in handy if you want to have search results automatically ranked by a criteria which is different for each record, e.g. the popularity of an article in your shop:


class Article
  acts_as_ferret :boost => :popularity
  def popularity
    # return dynamic boost value for this document
  end
end

You may also apply the dynamic boost to a specific field (or even different boosts to different fields), so it only is applied when a hit occurs in the boosted field. This way you can choose at query time if you want to have the boosting applied or not. Just query either the boosted fields, or the normal ones:


class Article
  acts_as_ferret :fields => { 
                             :title               => {}, 
                             :boosted_title => { :boost => :rating } 
                         }
  def rating
    # return rating of this article
  end

  # value for the boosted title field
  def boosted_title
    title
  end
end

New and better start/stop scripts

The DRb server now has a unified start/stop script and it ships with scripts for using the it as a Windows system service. Thanks to Peter Jones and Herryanto Siatono for contributing these.

Also the acts_as_ferret gem now has got an installer that will install the server script and sample config into your Rails project:


$ gem install acts_as_ferret
$ rails test
$ cd test/
$ aaf_install
$ script/ferret_server -e production start

And your DRb server is up and running. Easy, isn’t it?

No more :remote => true

Last but not least, aaf now is a bit more clever and goes into remote mode automatically if the DRb server is configured for the current environment. If for whatever reason you don’t want that, use :remote => false.

Comments
  1. DavidNovember 18, 2007 @ 11:55 PM
    How would one create a Linux-based startup script that started the Drb server as another user. For instance, mongrel has a configuration option in it's mongrel_cluster.yml that allows you to specify user and group. This is not available in ferret_server.yml. I've been trying to get something working, no luck so far though.
  2. jkNovember 19, 2007 @ 03:52 PM
    Looking into how Mongrel does it this shouldn't be too hard to implement. Created a ticket for this: http://projects.jkraemer.net/acts_as_ferret/ticket/183
  3. EstiNovember 20, 2007 @ 02:36 PM
    I tried to start the Drb server and I got a "not such file to load" error. I made it work by editing vendor/plugins/acts_as_ferret/lib/server_manager.rb, editing out line 46 require(File.join(File.dirname(__FILE__), '../../../../config/environment')) and commenting line 47 require(File.join(File.dirname(ENV['_']), '../config/environment')) Is that ok? Thanks!
  4. jkNovember 25, 2007 @ 05:35 PM
    This should work also. I use ENV there because when aaf is installed via a gem, __FILE__ is of no help with locating the the Rails environment. Not sure why it's not working for you.
  5. roger packDecember 04, 2007 @ 11:01 PM
    For win32 mingw users, note that you may need to do this: ruby c:\ruby_mingw2\bin\aaf_install to get it to install HOWEVER it doesn't seem to really work still. Looking into it.
  6. roger packDecember 05, 2007 @ 09:53 PM
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- server_manager (LoadError) means 'update your ferret/acts_as_ferret gems' (on osx, at least)...