acts_as_solr Rails plugin
About
This plugin adds full text search capabilities and many other nifty features from Apache‘s Solr to any Rails model. It was based on the first draft by Erik Hatcher.
The acts_as_solr's API documentation can be found here
Features
- Advanced Full-Text Search Capabilities
- Optimized for Low to High Volume Web Traffic
- Faceted Search: easy implementation of faceted navigation system that enables a user to navigate the search results hierarchically
- Highlighting of the search terms returned based on the keywords searched (coming soon)
- Indexing of Single Table Inheritances (STI's)
- Start and stop the Solr server with a simple rake command
- Indexing of any custom method defined in you models
- Ability of having multiple Solr instances running in the same servlet
- You have the option to specify the field types when indexing if you‘d like to preserve its original Solr field type
- Multi-model search, which can be used to execute a search across multiple models
- Model association indexing: you can include any :has_one, :has_many, :belongs_to and :has_and_belongs_to_many association to be indexed
- Boosting support for the entire document and/or on a per-field basis
- Support for models that don't use integer ids as the primary field
Authors
- Erik Hatcher: First draft
- Thiago Jackiw: Current developer (tjackiw at gmail dot com)
Current Release
The current stable release is v0.9 and was released on 06-18-2007.
Updating from version 0.8.5
If you are currently using the embedded Solr in production environment, please make sure you backup the data directory before upgrading to version 0.9 because the directory where Solr lives now is under acts_as_solr/solr instead of acts_as_solr/test/solr.
Changes
Please refer to the ChangeLog
Installation
Requirements
- Java Runtime Environment(JRE) 1.5 aka 5.0 (get it here)
Default
The acts_as_solr plugin has moved from Subverion to Git and it is now on GitHub? at http://github.com/railsfreaks/acts_as_solr
Optional
An external Solr installation. This plugin already includes Solr when you install it
If you want to use an instance of Solr other than the one included with this plugin, make sure you copy the schema.xml from the acts_as_solr‘s root directory to the DIR_WHERE_YOU_INSTALLED_SOLR/example/solr/conf
Micah Wedemeyer explains in detail how to configure acts_as_solr for development and production in one Tomcat instance
Updating an installed version (optional)
You can easily update your acts_as_solr plugin to the latest version by typing
script/plugin update
Note: This will also try to update any other plugins installed
Screencasts
Up and Running in less than 5 minutes
This short video tutorial demonstrates how easy it is to integrate Solr and the acts_as_solr plugin to any Rails application. You can watch the streamed version or download it to your computer.
Very Basic Usage
Using Solr
To start and stop the Solr server (this only works with the default installation)
rake solr:start|stop RAILS_ENV=your_env PORT=XX #Defaults to development:8982 if none given
Using the plugin
Just include the line below to any of your rails models:
class Book < ActiveRecord::Base acts_as_solr end
Or if you want, you can specify only the fields that should be indexed:
class Book < ActiveRecord::Base acts_as_solr :fields => [:name, :author] end
Then to find instances of your model, just do:
Book.find_by_solr(query) #Query is a string representing your query
Or if you want to specify the starting row and the number of rows per page:
Book.find_by_solr(query, :offset => 0, :limit => 10)
A more complete usage documentation can be found in the acts_as_solr's API
Getting help
- You can always use our mailing list http://groups.google.com/group/acts_as_solr to post any questions you may have.
- Have a look a the acts_as_solr's API, you may find you're looking for.
Contributing
I welcome contributors so if you‘d like to contribute to the development, please send me an email (tjackiw at gmail dot com).
Special Thanks
- Mingle, LLC (http://www.mingle.com) for the support
- Everyone that contributed with patches, bug reports, ideas, etc.
Release Information
Released under the MIT license. dfsd
