BigIndex
A Rails plugin that drops into models and provides indexing functionality. Uses an adapter/repository pattern inspired by Datamapper to abstract the actual indexer used in the background, and exposes the model to a simple indexing API.
This should be used in conjunction with BigRecord in order to provide a more complete ORM.
Supported search servers
-
Solr
-
Sphinx (planned)
Installation
(1) Download and install Solr. Take a note of the url that solr is running on.
(2) In your Rails application, add Bigindex as a gem to your config/environment.rb file:
config.gem "bigindex", :source => "http://gemcutter.org"
and run the following rake task to install all the gems listed for your Rails app:
[sudo] rake gems:install
(3) Bootstrap Bigindex into your Rails application:
script/generate bigindex
(4) Modify the config file config/bigindex.yml to correspond to your Solr server.
Getting Started
Modify your Ruby class/model similarly to the following:
class Model < BigRecord::Base
include BigIndex::Resource # 1. Include the BigIndex::Resource module into your model.
column :name, :string
column :description, :text
index :name, :string # 2. Define each attribute you want to index along with its type.
index :description # Defaults to type :text
end
BigIndex will then override the default Model.find() method to pass through the indexer first. Model.find() will also accept the option => true, which bypasses the indexed #find method and dispatches it to the original Model.find() method, e.g. Model.find(:all, :bypass_index => true). Alternatively, you can use Model.find_without_index(:all) for the same functionality.
License
Bigindex is released under the MIT license.
Contributions
Bigindex was derived from the work of Data Mapper and parts of acts_as_solr.
Links
-
Contact Us
-
Website - www.bigrecord.org
-
IRC Channel -
#bigrecordon irc.freenode.net
-