sunspot_mongoid 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +12 -0
- data/VERSION +1 -1
- data/rails/init.rb +1 -0
- metadata +2 -3
- data/examples/test.rb +0 -35
data/README.md
CHANGED
@@ -44,6 +44,18 @@ Example
|
|
44
44
|
#=> #<Post _id: 4c319556327b3c4b42000001, title: "foo">
|
45
45
|
#=> #<Post _id: 4c319556327b3c4b42000002, title: "foo bar">
|
46
46
|
|
47
|
+
Use as Rails plugin
|
48
|
+
----
|
49
|
+
|
50
|
+
add gems to Gemfile as following,
|
51
|
+
|
52
|
+
gem 'sunspot'
|
53
|
+
gem 'sunspot_rails'
|
54
|
+
|
55
|
+
and install sunspot_mongoid as rails plugin,
|
56
|
+
|
57
|
+
rails plugin install git://github.com/jugyo/sunspot_mongoid.git
|
58
|
+
|
47
59
|
Copyright
|
48
60
|
----
|
49
61
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/rails/init.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- jugyo
|
@@ -125,4 +125,3 @@ test_files:
|
|
125
125
|
- test/helper.rb
|
126
126
|
- test/test_sunspot_mongoid.rb
|
127
127
|
- examples/example.rb
|
128
|
-
- examples/test.rb
|
data/examples/test.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'sunspot_mongoid'
|
2
|
-
|
3
|
-
Mongoid.configure do |config|
|
4
|
-
config.master = Mongo::Connection.new.db('sunspot-mongoid-test')
|
5
|
-
end
|
6
|
-
|
7
|
-
# model
|
8
|
-
class Post
|
9
|
-
include Mongoid::Document
|
10
|
-
field :title
|
11
|
-
|
12
|
-
include Sunspot::Mongoid
|
13
|
-
sunspot_setup do
|
14
|
-
text :title
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# remove old indexes
|
19
|
-
Post.destroy_all
|
20
|
-
|
21
|
-
# indexing
|
22
|
-
Post.create(:title => 'foo')
|
23
|
-
Post.create(:title => 'foo bar')
|
24
|
-
Post.create(:title => 'bar baz')
|
25
|
-
|
26
|
-
# commit
|
27
|
-
Sunspot.commit
|
28
|
-
|
29
|
-
# search
|
30
|
-
search = Post.search do
|
31
|
-
keywords 'foo'
|
32
|
-
end
|
33
|
-
search.each_hit_with_result do |hit, post|
|
34
|
-
p post
|
35
|
-
end
|