Since the original authors abandoned acts_as_solr a while ago, this has sort of become the mainline branch for new changes. I took Luke Francl’s version, added a few features of my own, and also a new and fast unit test suite that doesn’t test integration with Solr and Rails, but only the functionality itself.
Currently there’s a rework of the plugin in progress on the refactoring branch.
acts_as_solr comes with an embedded Jetty installation which allows you to run it directly from within your application. The only thing you need to have installed is a Java Development Kit.
To start the server:
Add an environment as you please, default is development. test/development/production all run on different ports.
To stop the server:
In your models, add this line which will by default index all fields in the class:
class User < ActiveRecord::Base acts_as_solr end
See the RDoc for a full list of the available options.
If you’re adding Solr to an existing application, and you want to build an index on your existing data, you can do using the
There’s a rake task to help you get an initial index up and running faster than the above using some more fitting defaults:
rake solr:reindex ONLY=user,article
It also support
START_SERVER (will fire up Solr before indexing). It will delete the existing index first, if you don’t want that, use
CLEAR=false. It will optimize the index after it’s done, disable that using
OPTIMIZE=false. By default it uses a batch size of 300 before it commits anything to the index, if you want to finetune that number, set
BATCH to the number you want.
Patches are most welcome of course. If you submit a pull request, please be sure to include tests for your change. If it’s a bigger one, a functional test would be much appreciated.
Most of these are slightly older, but still valid for the most part.
Drop by the Google Group and ask your questions.