search_flip 4.0.0.beta1 → 4.0.0.beta2

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
  SHA256:
3
- metadata.gz: 3e231e9ac3434626705696aea544b0ab30a134de6c6773129e779e6ae7adfab4
4
- data.tar.gz: 7fe5852eda4d9d73a1a6bfe14e1c6d807bffa08c47c15c137d624dd4050bbcd5
3
+ metadata.gz: be586199f9609b395d29218436d8618e283610189dde3805b76145f1c44b3c52
4
+ data.tar.gz: 7312acda3dce1c1080cf9c6ee3ca10c3e6aab8556b152c9304c09af25aa61e12
5
5
  SHA512:
6
- metadata.gz: ec79c30df34f4cfdb9f8afcd25f4d982d1b03461a00af7a9055f4c48d0b5ffc346cccaed178a6e9137d6cd681f538beaf129d449070b44806966c27ea585d112
7
- data.tar.gz: 23c9ea04e2d39447a0aaae56f215e3d6cce59c0c67187ba7a9ca18e509e1cbf22dd8dbd52007f4131880a1f97f9fea23e29892f491d5351f39f7b62019afe921
6
+ metadata.gz: 813ff8f5a836e56db83cdf11b15c85003a849572df83401411770ceed0309aac7214ed7d1640b843c85e3b4a910a38db3b8c5b6af298e7d8cff950d23a36572e
7
+ data.tar.gz: eb564e52771cf80668ae3bdfe145b533580ab04a3120fefdac75e6d661c4512c423606c80daa639940718f9c425d221c51d2e892e0cf184a634e3eead3cf8c06
@@ -2,15 +2,19 @@ AllCops:
2
2
  NewCops: enable
3
3
  TargetRubyVersion: 2.4
4
4
 
5
- Gemspec/RequiredRubyVersion:
6
- Enabled: false
7
-
8
5
  Style/CaseLikeIf:
9
6
  Enabled: false
10
7
 
8
+ Lint/EmptyBlock:
9
+ Exclude:
10
+ - spec/**/*.rb
11
+
11
12
  Style/ExplicitBlockArgument:
12
13
  Enabled: false
13
14
 
15
+ Gemspec/RequiredRubyVersion:
16
+ Enabled: false
17
+
14
18
  Style/HashTransformValues:
15
19
  Enabled: false
16
20
 
@@ -8,6 +8,8 @@
8
8
  * It no longer supports symbol based access like `result[:id]`
9
9
  * It no longer supports question mark methods like `result.title?`
10
10
  * It no longer supports method based assignment like `result.some_key = "value"`
11
+ * Added `SearchFlip::Connection#get_cluster_settings` and
12
+ `#update_cluster_settings`
11
13
 
12
14
  ## v3.1.2
13
15
 
@@ -19,6 +19,33 @@ module SearchFlip
19
19
  @version_mutex = Mutex.new
20
20
  end
21
21
 
22
+ # Queries the cluster settings from Elasticsearch
23
+ #
24
+ # @example
25
+ # connection.get_cluster_settings
26
+ # # => { "persistent" => { ... }, ... }
27
+ #
28
+ # @return [Hash] The cluster settings
29
+
30
+ def get_cluster_settings
31
+ http_client.get("#{base_url}/_cluster/settings").parse
32
+ end
33
+
34
+ # Updates the cluster settings according to the specified payload
35
+ #
36
+ # @example
37
+ # connection.update_cluster_settings(persistent: { action: { auto_create_index: false } })
38
+ #
39
+ # @param cluster_settings [Hash] The cluster settings
40
+ #
41
+ # @return [Boolean] Returns true or raises SearchFlip::ResponseError
42
+
43
+ def update_cluster_settings(cluster_settings)
44
+ http_client.put("#{base_url}/_cluster/settings", json: cluster_settings)
45
+
46
+ true
47
+ end
48
+
22
49
  # Queries and returns the Elasticsearch version used.
23
50
  #
24
51
  # @example
@@ -153,7 +153,7 @@ module SearchFlip
153
153
  # scope to be applied to the scope
154
154
 
155
155
  def each_record(scope, index_scope: false)
156
- return enum_for(:each_record, scope) unless block_given?
156
+ return enum_for(:each_record, scope, index_scope: index_scope) unless block_given?
157
157
 
158
158
  if scope.respond_to?(:find_each)
159
159
  (index_scope ? self.index_scope(scope) : scope).find_each do |record|
@@ -34,13 +34,13 @@ module SearchFlip
34
34
  end
35
35
  end
36
36
 
37
- # rubocop:disable Lint/MissingSuper
37
+ # rubocop:disable Style/MissingSuper
38
38
 
39
39
  def method_missing(name, *args, &block)
40
40
  self[name.to_s]
41
41
  end
42
42
 
43
- # rubocop:enable Lint/MissingSuper
43
+ # rubocop:enable Style/MissingSuper
44
44
 
45
45
  def respond_to_missing?(name, include_private = false)
46
46
  key?(name.to_s) || super
@@ -1,3 +1,3 @@
1
1
  module SearchFlip
2
- VERSION = "4.0.0.beta1"
2
+ VERSION = "4.0.0.beta2"
3
3
  end
@@ -19,6 +19,35 @@ RSpec.describe SearchFlip::Connection do
19
19
  end
20
20
  end
21
21
 
22
+ describe "#get_cluster_settings" do
23
+ it "returns the cluster settings" do
24
+ expect(SearchFlip::Connection.new.get_cluster_settings).to be_kind_of(Hash)
25
+ end
26
+ end
27
+
28
+ describe "#update_cluster_settings" do
29
+ let(:connection) { SearchFlip::Connection.new }
30
+
31
+ after do
32
+ connection.update_cluster_settings(persistent: { action: { auto_create_index: false } }) if connection.version.to_i > 2
33
+ end
34
+
35
+ it "updates the cluster settings" do
36
+ if connection.version.to_i > 2
37
+ connection.update_cluster_settings(persistent: { action: { auto_create_index: false } })
38
+ connection.update_cluster_settings(persistent: { action: { auto_create_index: true } })
39
+
40
+ expect(connection.get_cluster_settings["persistent"]["action"]["auto_create_index"]).to eq("true")
41
+ end
42
+ end
43
+
44
+ it "returns true" do
45
+ if connection.version.to_i > 2
46
+ expect(connection.update_cluster_settings(persistent: { action: { auto_create_index: false } })).to eq(true)
47
+ end
48
+ end
49
+ end
50
+
22
51
  describe "#msearch" do
23
52
  it "sends multiple queries and returns all responses" do
24
53
  ProductIndex.import create(:product)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_flip
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta1
4
+ version: 4.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-29 00:00:00.000000000 Z
11
+ date: 2020-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord