Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.41 KB

README.rdoc

File metadata and controls

48 lines (33 loc) · 1.41 KB

SolandraObject

SolandraObject merges the functionality of Gotime’s CassandraObject and Sunspot::Rails. It does this by automatically indexing attributes declared as part of the model. The general idea is to use this with Solandra so that your index is distributed along with your data, but if you’re not running distributed then there’s no reason it can’t be used with a normal SOLR installation.

Installation

Add the following to your Gemfile:

gem 'thrift', '~> 0.7.0'
gem 'cassandra', '~> 0.12.1'
gem 'solandra_object', '~> 0.1.0'

Change version numbers as appropriate.

Of course you need a solr/solandra instance running to use this. It also needs to be properly configured. Create a default config file for sunspot_rails like this:

rails generate sunspot_rails:install

Then edit config/sunspot.yml appropriately. You might need to set the path option for solr like

path: /solandra

when using Solandra (you will get 404 errors if this setting is incorrect).

Configure solandra with the SolandraObject schema:

rake so:create_solr
rake so:create_solr RAILS_ENV=test

Example

class Category < SolandraObject::Base
  key :uuid
  string :name
  string :description
  array :sub_categories, :unique => true
  json :extra_attributes
end

For more examples and instructions on how to use this, see the API docs and consult the documentation sunspot, sunspot_rails, cassandra_object and solandra.