Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Sunspot search support for Mongo Mapper and Mongoid.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore initial commit August 11, 2011
Octocat-spinner-32 Gemfile initial commit August 11, 2011
Octocat-spinner-32 Guardfile
Octocat-spinner-32 LICENSE implement August 11, 2011
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile implement August 11, 2011
Octocat-spinner-32 sunspot_mongo.gemspec Updated authors and URL in gemspec March 06, 2012
README.rdoc

Installation

Mongo Mapper

Put the following in your Gemfile:

gem 'bson_ext'
gem 'mongo_mapper'
gem 'sunspot_mongo'

Then run:

rails g mongo_mapper:config
rails g sunspot_rails:install
rake sunspot:solr:start

Mongoid

gem 'bson_ext'
gem 'mongoid'
gem 'sunspot_mongo'

Then run:

rails g mongoid:config
rails g sunspot_rails:install
rake sunspot:solr:start

Usage

Add the following to your model (assuming you have a string field named “content”):

include Sunspot::Mongo
searchable do
  text :content
end

Then search like usual:

search = Article.search do
  fulltext "something interesting"
end
search.results

Note: Mongoid adds Article.search, use Article.solr_search instead.

More info

See the Sunspot documentation.

Compatibility

This gem has been tested against Ruby 1.9.2 and Rails 3.1, although it should work with older versions.

Credit

Based on sunspot_mongoid by jugyo. Originally developed by balexand.

Something went wrong with that request. Please try again.