(Arbitrarily) in the style of blather.newdream.net, of which I have fond memories.
Getting started with Sunspot and Websolr
Want to see all of this in one single copy-pasteable block? Skip to "Delicious copypasta" below.
Installing Sunspot with Bundler
sunspot_rails to your
gem 'sunspot_rails', :git => 'http://github.com/outoftime/sunspot.git'
bundle install from the root of your application to install
sunspot_rails and its dependencies.
N.B: As of 24Aug10 we are using Sunspot from git since there are a few Rails 3 fixes not yet released in the RC gem.
Configure Sunspot for Websolr
Using an environment variable
For applications hosted on Heroku, the URL to your index will be set to the
WEBSOLR_URL environment variable. Create a Sunspot initializer at
config/initializers/websolr.rb with the following line:
Sunspot.config.solr.url = ENV['WEBSOLR_URL']
Alternatively, you can use
config/sunspot.yml to configure Sunspot.
rails generate sunspot_rails:install
This command will generate a default
config/sunspot.yml which you may edit to provide the details for your production index. For example, update your production configuration to mimic the following, altering the path value to match the location of your index.
production: solr: hostname: index.websolr.com port: 80 path: /solr/0a1b2c3d4e log_level: WARNING
The copy-paste version
All of the above in one place for your convenience:
echo "gem 'sunspot_rails', '1.2rc2'" >> Gemfile bundle install echo "Sunspot.config.solr.url = ENV['WEBSOLR_URL']" > config/initializers/websolr.rb