Permalink
Browse files

update README

  • Loading branch information...
1 parent db610f5 commit 0e86c3213a7c728b0fc8f9c4ee5683d31a91464c @jugyo committed Jul 5, 2010
Showing with 21 additions and 25 deletions.
  1. +21 −25 README.md
View
@@ -3,18 +3,14 @@ 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
@@ -25,27 +21,21 @@ Example
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
-----
+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,
@@ -56,6 +46,12 @@ 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
----

0 comments on commit 0e86c32

Please sign in to comment.