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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70c322f4b4cde8641a2f498e1b3f4df697070239
4
- data.tar.gz: 9beac903f1d23efe9d85257bb19ddf0cc0439fe6
3
+ metadata.gz: 7226da6b12334e85be0c4038024e32b92d31ba49
4
+ data.tar.gz: 988619ce3a29ada94380c78d978c96d998e4cf34
5
5
  SHA512:
6
- metadata.gz: 0977850c4ca620de45102cd4ab420030ae93d54d37f9f61878a14a6a6bd1a40bb47069b947648657ac141ef0cbc60b7d1eb9c1cb1864927b06c3e7f801a6ddee
7
- data.tar.gz: b7d08fb4ec1c184d67d71772f314b938702fc90c57fb48b2942d20415d33b37da95833c03f6bc300d0455a62c77f8b7b4f77b5a867e0b8bcdbfda72301c552e4
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
- # Search multiple models
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'
@@ -68,6 +68,7 @@ module Mongoid
68
68
  }
69
69
  }
70
70
  results = client.suggest(index: index.name, body: body)
71
+ p results
71
72
  results['q'][0]['options']
72
73
  end
73
74
  end
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # source: https://github.com/karmi/retire/blob/master/lib/tire/utils.rb
2
3
  require 'uri'
3
4
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Elasticsearch
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
@@ -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
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require "spec_helper"
2
3
 
3
4
  describe Article do
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.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-05 00:00:00.000000000 Z
11
+ date: 2013-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid