Sunspot

Solr-powered search for Ruby objects

All the power of the Solr search engine; all the beauty of Ruby. Sunspot exposes all of Solr's most powerful search features using an API of elegant DSLs. That means robust, flexible fulltext search with no boolean queries and no string programming.

Index your objects.

class Post < ActiveRecord::Base
  searchable do
    text :title, :body
    text :comments do
      comments.map { |comment| comment.body }
    end
    integer :blog_id
    integer :author_id
    integer :category_ids, :multiple => true
    time :published_at
    string :sort_title do
      title.downcase.gsub(/^(an?|the)\b/, '')
    end
  end
end

Search for them.

Post.search do
  fulltext 'best pizza'
  with :blog_id, 1
  with(:published_at).less_than Time.now
  order_by :published_at, :desc
  paginate :page => 2, :per_page => 15
  facet :category_ids, :author_id
end

Use it with or without Rails.

The sunspot_rails gem integrates Sunspot into Rails with drop-in ease, extending ActiveRecord objects for searchability and managing the commit cycle transparently. sunspot_rails works with Rails 2.3 and Rails 3.0. See the Quickstart with Rails 3 in the README to get started.

If you're not using Rails, or you're using Rails without ActiveRecord, the core Sunspot library can be hooked into your persistence layer with just a few lines of code.

Get started.

Start with the README.
Learn more on the Wiki.
Consult the API documentation for a detailed reference.
Ask questions on the Google Group.
Chat about it on IRC #sunspot-ruby @ freenode.
Give it a shout out on Ruby Toolbox.
Follow announcements on Twitter at @sunspot_ruby.

Contribute.

Browse the source.
Report bugs on GitHub Issues.
Propose new features on the Google Group.
Submit a pull request on GitHub.

Fork me on GitHub