Module ActiveRecord::Acts::Searchable
In: lib/acts_as_searchable.rb

Specify this act if you want to provide fulltext search capabilities to your model via Hyper Estraier. This assumes a setup and running Hyper Estraier node accessible through the HTTP API provided by the EstraierPure Ruby module (which is bundled with this plugin).

The act supplies appropriate hooks to insert, update and remove documents from the index when you update your model data, create new objects or remove them from your database. For the initial indexing a convenience class method reindex! is provided.


  class Article < ActiveRecord::Base


As soon as your model data has been indexed you can make use of the fulltext_search class method to search the index and get back instantiated matches.

  results = Article.fulltext_search('rails')
  results.size        # => 3

  results.first.class # => Article
  results.first.body  # => "Ruby on Rails is an open-source web framework"

Connectivity configuration can be either inherited from conventions or setup globally in the Rails database configuration file config/database.yml.


    adapter: mysql
    database: rails_development
    host: localhost
    user: root
      host: localhost
      user: admin
      password: admin
      port: 1978
      node: development

That way you can configure separate connections for each environment. The values shown above represent the defaults. If you don’t need to change any of these it is safe to not specify the estraier hash at all.

See ActiveRecord::Acts::Searchable::ClassMethods#acts_as_searchable for per-model configuration options

Classes and Modules

Module ActiveRecord::Acts::Searchable::ActMethods
Module ActiveRecord::Acts::Searchable::ClassMethods