wonsys / acts_as_fulltextable

Acts as Fulltextable plugin by Wonsys S.r.l.

This URL has Read+Write access

name age message
file .gitignore Sun May 18 10:17:17 -0700 2008 Added .gitignore git-svn-id: https://wonsys.g... [flydown]
file LICENSE Fri Oct 05 01:19:58 -0700 2007 Move from OpenSVN to Google Code git-svn-id: h... [flydown]
file README Fri Oct 05 01:38:14 -0700 2007 Updated README to reflect move to Google Code ... [flydown]
file Rakefile Fri Oct 05 01:19:58 -0700 2007 Move from OpenSVN to Google Code git-svn-id: h... [flydown]
directory generators/ Fri Dec 07 07:07:12 -0800 2007 Added support for scoping using parent_id git-... [flydown]
file init.rb Fri Oct 05 01:19:58 -0700 2007 Move from OpenSVN to Google Code git-svn-id: h... [flydown]
file install.rb Wed May 14 04:49:53 -0700 2008 Added post install instruction on how to preven... [flydown]
directory lib/ Wed Jan 07 03:35:40 -0800 2009 Added phrase search and AND search [michele]
directory tasks/ Fri Oct 05 01:19:58 -0700 2007 Move from OpenSVN to Google Code git-svn-id: h... [flydown]
directory test/ Fri Oct 05 01:19:58 -0700 2007 Move from OpenSVN to Google Code git-svn-id: h... [flydown]
file uninstall.rb Fri Oct 05 01:19:58 -0700 2007 Move from OpenSVN to Google Code git-svn-id: h... [flydown]
README
ActsAsFulltextable
==================

It allows you to create an auxiliary to be used for full-text searches.
It behaves like a polymorphic association, so it can be used with any
ActiveRecord model.

See http://blog.wonsys.net/posts/26-our-first-plugin-acts_as_fulltextable/ and
http://code.google.com/p/wonsys/

Bug tracker: http://wonsysos.16bugs.com/

Only tested with MySQL 5.x

== Step 1

Install the plugin:
  script/plugin install http://wonsys.googlecode.com/svn/plugins/acts_as_fulltextable/

== Step 2

Add the following code to the model that should be included in searches:
  acts_as_fulltextable :fields, :to, :include, :in, :index

== Step 3

Create the migration:
  script/generate fulltext_rows model1 model2 model3 ...

Then execute it:
  rake db:migrate

== Run searches

You can either run a search on a single model:
  Model.find_fulltext('query to run', :limit => 10, :offset => 0)

Or you can run it on more models at once:
  FulltextRow.search('query to run', :only => [:only, :this, :models], :limit => 10, :offset => 0)

== Warning

Should you add acts_as_fulltextable to a new model after the initial migration was run,
you should execute the following piece of code (a migration or script/console are both fine):
  
  NewModel.find(:all).each {|i| i.create_fulltext_record}

It will add all of the model's instances to the index.

== Contact us

If you experience any issues, please file a bug report at:
  http://wonsysos.16bugs.com/