Monday, May 22, 2006

acts_as_searchable

Looking at implementing full-text searching in your Rails app? Look no further than acts_as_searchable. Using Hyper Estraier, it allows you to easily implement full text searching. To setup acts_as_searchable, I basically followed the instructions over here. It was fairly self explainitory and easy to setup for Windows, but a couple of things caused me confusion:

  • The yaml listed on the site doesn't work because of the spacing. The "host" and "node" elements should be children of the "estraier" element NOT "port".
  • I couldn't get the plugin to install (I may not have svn installed correctly?), so I ended up installing the hyper estraier gem using "gem install acts_as_searchable"
    • Since I didn't get the plugin to install I had to add "require 'acts_as_searchable'" to my model.
  • Once the hyper estraier server is running, you need to execute the re-index code.  Run ActiveRecord.reindex! where ActiveRecord is the name of your model. I ended up  creating a  controller method that I could hit and reindex everything to get started (not a good idea for production).
  • A bunch of files and directories get created upon reindexing. The name of the directory reflect the name of the index that's being used. They are created in the current working directory.
  • The server needs to be started from the same working directory each time. If you start the server from a different directory, you will not see any of the users or nodes that you created from previous sessions.
Hopefully this helps anyone trying to setup acts_as_searchable or looking for a full text search engine for their Rails app.

1 Comments:

Anonymous Anonymous said...

Thanks this helped a lot. I wish it could bumped up in google to help others which must have the same problem. "acts_as_searchable yaml" was how I found it.

The anonymous comments helped too, as I can't be bothered signing for a blogger account.

6/08/2006 05:58:00 AM

 

Post a Comment

<< Home