search_flip 4.0.0.beta1 → 4.0.0.beta2
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/.rubocop.yml +7 -3
- data/CHANGELOG.md +2 -0
- data/lib/search_flip/connection.rb +27 -0
- data/lib/search_flip/index.rb +1 -1
- data/lib/search_flip/result.rb +2 -2
- data/lib/search_flip/version.rb +1 -1
- data/spec/search_flip/connection_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be586199f9609b395d29218436d8618e283610189dde3805b76145f1c44b3c52
|
4
|
+
data.tar.gz: 7312acda3dce1c1080cf9c6ee3ca10c3e6aab8556b152c9304c09af25aa61e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 813ff8f5a836e56db83cdf11b15c85003a849572df83401411770ceed0309aac7214ed7d1640b843c85e3b4a910a38db3b8c5b6af298e7d8cff950d23a36572e
|
7
|
+
data.tar.gz: eb564e52771cf80668ae3bdfe145b533580ab04a3120fefdac75e6d661c4512c423606c80daa639940718f9c425d221c51d2e892e0cf184a634e3eead3cf8c06
|
data/.rubocop.yml
CHANGED
@@ -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
|
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/lib/search_flip/index.rb
CHANGED
@@ -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|
|
data/lib/search_flip/result.rb
CHANGED
@@ -34,13 +34,13 @@ module SearchFlip
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
# rubocop:disable
|
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
|
43
|
+
# rubocop:enable Style/MissingSuper
|
44
44
|
|
45
45
|
def respond_to_missing?(name, include_private = false)
|
46
46
|
key?(name.to_s) || super
|
data/lib/search_flip/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|