Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update README

  • Loading branch information...
commit 0e86c3213a7c728b0fc8f9c4ee5683d31a91464c 1 parent db610f5
jugyo authored

Showing 1 changed file with 21 additions and 25 deletions. Show diff stats Hide diff stats

  1. +21 25 README.md
46 README.md
Source Rendered
@@ -3,18 +3,14 @@ sunspot_mongoid
3 3
4 4 A Sunspot wrapper for Mongoid.
5 5
6   -See also: [http://github.com/outoftime/sunspot/tree/master/sunspot_rails/](http://github.com/outoftime/sunspot/tree/master/sunspot_rails/)
7   -
8   -Example
  6 +Install
9 7 ----
10 8
11   - require 'sunspot_mongoid'
  9 + gem install sunspot_mongoid
12 10
13   - Mongoid.configure do |config|
14   - config.master = Mongo::Connection.new.db('sunspot-mongoid-test')
15   - end
  11 +Examples
  12 +----
16 13
17   - # model
18 14 class Post
19 15 include Mongoid::Document
20 16 field :title
@@ -25,27 +21,21 @@ Example
25 21 end
26 22 end
27 23
28   - # indexing
29   - Post.create(:title => 'foo')
30   - Post.create(:title => 'foo bar')
31   - Post.create(:title => 'bar baz')
  24 +For Rails3
  25 +----
32 26
33   - # commit
34   - Sunspot.commit
  27 +### as gem:
35 28
36   - # search
37   - search = Post.search do
38   - keywords 'foo'
39   - end
40   - search.each_hit_with_result do |hit, post|
41   - p post
42   - end
  29 +add a gem to Gemfile as following,
43 30
44   - #=> #<Post _id: 4c319556327b3c4b42000001, title: "foo">
45   - #=> #<Post _id: 4c319556327b3c4b42000002, title: "foo bar">
  31 + gem 'sunspot_mongoid'
46 32
47   -Use as Rails plugin
48   -----
  33 +config/initializers/sunspot_mongoid.rb
  34 +
  35 + Sunspot.session = Sunspot::Rails.build_session
  36 + ActionController::Base.module_eval { include(Sunspot::Rails::RequestLifecycle) }
  37 +
  38 +### as plugin:
49 39
50 40 add gems to Gemfile as following,
51 41
@@ -56,6 +46,12 @@ and install sunspot_mongoid as rails plugin,
56 46
57 47 rails plugin install git://github.com/jugyo/sunspot_mongoid.git
58 48
  49 +Links
  50 +----
  51 +
  52 +* [sunspot](http://github.com/outoftime/sunspot)
  53 +* [sunspot_rails](http://github.com/outoftime/sunspot/tree/master/sunspot_rails/)
  54 +
59 55 Copyright
60 56 ----
61 57

0 comments on commit 0e86c32

Please sign in to comment.
Something went wrong with that request. Please try again.