Skip to content
[no longer maintained]Sunspot search for both MongoDB. Supports Mongo Mapper and Mongoid.
Pull request Compare This branch is 35 commits behind derekharmel:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
LICENSE
README.rdoc
Rakefile
sunspot_mongo.gemspec

README.rdoc

NOT MAINTAINED

I'm no longer maintaining this project. If anyone would like to take it over then please let me know. For my new projects I'm switching from Solr and Sunspot to ElasticSearch and Tire.

Why Elasticsearch

  • Powerful and built on Lucene (like Solr)

  • Schema free and dead simple to set up

  • Elegant and simple RESTful API

  • Simple sharding and replication

  • Beautiful website with excellent documentation

Why Tire

  • Nice API (like Sunspot)

  • Integrates with ActiveModel instead of ActiveRecord. This means it works with MongoMapper out of the box.

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

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.

Something went wrong with that request. Please try again.