README.md in sunspot_mongoid-0.2.0 vs README.md in sunspot_mongoid-0.3.0

- old
+ new

@@ -1,61 +1,57 @@ sunspot_mongoid ==== A Sunspot wrapper for Mongoid. -See also: [http://github.com/outoftime/sunspot/tree/master/sunspot_rails/](http://github.com/outoftime/sunspot/tree/master/sunspot_rails/) - -Example +Install ---- - require 'sunspot_mongoid' + gem install sunspot_mongoid - Mongoid.configure do |config| - config.master = Mongo::Connection.new.db('sunspot-mongoid-test') - end +Examples +---- - # model class Post include Mongoid::Document field :title include Sunspot::Mongoid searchable do text :title end end - # indexing - Post.create(:title => 'foo') - Post.create(:title => 'foo bar') - Post.create(:title => 'bar baz') +For Rails3 +---- - # commit - Sunspot.commit +### as gem: - # search - search = Post.search do - keywords 'foo' - end - search.each_hit_with_result do |hit, post| - p post - end +add a gem to Gemfile as following, - #=> #<Post _id: 4c319556327b3c4b42000001, title: "foo"> - #=> #<Post _id: 4c319556327b3c4b42000002, title: "foo bar"> + gem 'sunspot_mongoid' -Use as Rails plugin ----- +create config/initializers/sunspot_mongoid.rb, + Sunspot.session = Sunspot::Rails.build_session + ActionController::Base.module_eval { include(Sunspot::Rails::RequestLifecycle) } + +### as plugin: + add gems to Gemfile as following, gem 'sunspot' gem 'sunspot_rails' and install sunspot_mongoid as rails plugin, rails plugin install git://github.com/jugyo/sunspot_mongoid.git + +Links +---- + +* [sunspot](http://github.com/outoftime/sunspot) +* [sunspot_rails](http://github.com/outoftime/sunspot/tree/master/sunspot_rails/) Copyright ---- Copyright (c) 2010 jugyo. See LICENSE for details.