wj-mongoid-elasticsearch 0.0.5 → 0.0.6

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: ed51025a8797c0ead1ce01e9bce500f465aeed22
4
- data.tar.gz: 3e40c6978d0d607a0f6a0335a1389447285c7a4b
3
+ metadata.gz: e36c98b55fbf18a62cf9043750cbb928c5616c72
4
+ data.tar.gz: d8985a2805ef2930ed1a3fa9efaec6c6a168d09b
5
5
  SHA512:
6
- metadata.gz: 6645b0ca4a9b00c7d390e4dfa8851bf6b547be099b14ec739d3b57d2650219bd907e8aa99c6c3d038a1120fc8dcdac9115f20322cc9457dddd7c012dcbef8a6f
7
- data.tar.gz: 3990872125e3d7700ee9b7902468f7e4eb9beb623cf948e044aae4bc369c0ca35b71722da488d72da0d5aa6d1b5fd3258b6e4038775b12029816be7e15461b60
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
- after_save :update_es_index
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)
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Elasticsearch
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
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.5
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-08-19 00:00:00.000000000 Z
11
+ date: 2018-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid