wj-mongoid-elasticsearch 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/lib/mongoid/elasticsearch/callbacks.rb +12 -2
- data/lib/mongoid/elasticsearch/es.rb +12 -1
- data/lib/mongoid/elasticsearch/version.rb +1 -1
- 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: e36c98b55fbf18a62cf9043750cbb928c5616c72
|
4
|
+
data.tar.gz: d8985a2805ef2930ed1a3fa9efaec6c6a168d09b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2b00898e10eaeb55b3c58bf7245b1bd5d5701e1ab1970ac4937fc311ab8bd465548c664b5b0780e44d959c861fcbd9f9324890f6de05991cf0e28f466470a87
|
7
|
+
data.tar.gz: 9853ba9dc93433061f88841d7114f76daa2929ea0bc393f5f517d75b4fd46f07b83551dfdcf6b9c728f64f7860404e0e182c96fb4515a8e2064a8a3b0486eb90
|
@@ -4,20 +4,30 @@ module Mongoid
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
|
7
|
+
## COMMENTED OUT THIS LINE, SO THAT WE CAN DO THE CREATE MANUALLY.
|
8
|
+
#after_save :update_es_index
|
8
9
|
after_destroy :update_es_index
|
9
|
-
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
10
14
|
## THIS FUNCTION HAS BEEN UPDATED TO DO THE UPDATE ONLY IF THE OP_SUCCESS IS TRUE OR NIL, IN CASE THE RECORD RESPONDS TO OP_SUCCESS.
|
11
15
|
def update_es_index
|
16
|
+
|
12
17
|
if self.respond_to? :op_success
|
18
|
+
|
13
19
|
if self.op_success.nil?
|
20
|
+
|
14
21
|
es_update
|
15
22
|
else
|
23
|
+
|
16
24
|
es_update if self.op_success == true
|
17
25
|
end
|
18
26
|
else
|
27
|
+
|
19
28
|
es_update
|
20
29
|
end
|
30
|
+
|
21
31
|
end
|
22
32
|
end
|
23
33
|
|
@@ -97,7 +97,18 @@ module Mongoid
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def index_item(obj)
|
100
|
-
client.index({body: obj.as_indexed_json}.merge(options_for(obj)))
|
100
|
+
response = client.index({body: obj.as_indexed_json}.merge(options_for(obj)))
|
101
|
+
end
|
102
|
+
|
103
|
+
##############################################################
|
104
|
+
##
|
105
|
+
##
|
106
|
+
## ADDED THIS METHOD TO UPDATE A RECORD IN THE DATABASE.
|
107
|
+
##
|
108
|
+
##
|
109
|
+
##############################################################
|
110
|
+
def update_item(obj)
|
111
|
+
|
101
112
|
end
|
102
113
|
|
103
114
|
def remove_item(obj)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wj-mongoid-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|