mongoid-elasticsearch 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -2
- data/lib/mongoid/elasticsearch/es.rb +1 -0
- data/lib/mongoid/elasticsearch/utils.rb +1 -0
- data/lib/mongoid/elasticsearch/version.rb +1 -1
- data/spec/models/article.rb +2 -2
- data/spec/mongoid_elasticsearch_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7226da6b12334e85be0c4038024e32b92d31ba49
|
4
|
+
data.tar.gz: 988619ce3a29ada94380c78d978c96d998e4cf34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2c195f0a5480b5825721a8badcd8eb6a2548a1118d0788e8f425d850ec10b86b13fe61e8b2294c178ade73434c5e41be43ea585cc054677aa8b5ccac979463f
|
7
|
+
data.tar.gz: 7c29a7602aa59a51824434bdb0b9ed14b893588ee12c11602c21509e0ec15e902bf974f6fec006b365e824b62eecfb36b27dff738b2947df3254eb2f8ef2c639
|
data/README.md
CHANGED
@@ -70,9 +70,25 @@ Or install it yourself as:
|
|
70
70
|
Post.es.index.reset # recreate index
|
71
71
|
Post.es.index.refresh # force index update (useful for specs)
|
72
72
|
Post.es.client # Elasticsearch::Client instance
|
73
|
-
Post.es.completion('te') # requires ES 0.90.3
|
74
73
|
|
75
|
-
|
74
|
+
### Completion:
|
75
|
+
|
76
|
+
include Mongoid::Elasticsearch
|
77
|
+
elasticsearch! index_mappings: {
|
78
|
+
name: {
|
79
|
+
type: 'multi_field',
|
80
|
+
fields: {
|
81
|
+
name: {type: 'string', boost: 10},
|
82
|
+
suggest: {type: 'completion'}
|
83
|
+
}
|
84
|
+
},
|
85
|
+
desc: {type: 'string'},
|
86
|
+
}
|
87
|
+
|
88
|
+
Post.es.completion('te', 'name.suggest') # requires ES 0.90.3
|
89
|
+
|
90
|
+
### Search multiple models:
|
91
|
+
|
76
92
|
# By default only searches in indexes managed by Mongoid::Elasticsearch
|
77
93
|
# to ignore other apps indexes in same ES instance
|
78
94
|
response = Mongoid::Elasticsearch.search 'test'
|
data/spec/models/article.rb
CHANGED
@@ -13,8 +13,7 @@ class Article
|
|
13
13
|
include Mongoid::Elasticsearch
|
14
14
|
i_fields = {
|
15
15
|
name: {type: 'string', analyzer: 'snowball'},
|
16
|
-
raw: {type: 'string', index: :not_analyzed}
|
17
|
-
_slugs: {type: 'string', index: :not_analyzed}
|
16
|
+
raw: {type: 'string', index: :not_analyzed}
|
18
17
|
}
|
19
18
|
|
20
19
|
if Gem::Version.new(::Elasticsearch::Client.new.info['version']['number']) > Gem::Version.new('0.90.2')
|
@@ -26,6 +25,7 @@ class Article
|
|
26
25
|
type: 'multi_field',
|
27
26
|
fields: i_fields
|
28
27
|
},
|
28
|
+
_slugs: {type: 'string', index: :not_analyzed},
|
29
29
|
tags: {type: 'string', include_in_all: false}
|
30
30
|
}, wrapper: :load
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|