search_flip 2.1.0.beta1 → 2.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/search_flip/connection.rb +4 -1
- data/lib/search_flip/index.rb +6 -2
- data/lib/search_flip/version.rb +1 -1
- data/lib/search_flip.rb +1 -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: 6b3740c9ca1f4b34538a0302d4efc92afb12ee845d1b534241070ade3255b4dd
|
4
|
+
data.tar.gz: afb51d3e77ef804e3487da46a8f5db33a9d5baa9dd17337afb09fa4874b710e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e43715270ac96cd15933a6e2243c9f61dec661abe6b70e1aba93d411a7ebaa19c528a6c9f5d11950babd48f144afef06a4b5be29d91bc2d820bc014b81e951
|
7
|
+
data.tar.gz: be195c055a264206dd2a85657fd8c874d8e09661e6bb9d39f0fbc80f1c30cda3ce006082540c739d00eadecbf0f4e2fd68805e4c0099393bbe153986864a67a3
|
data/README.md
CHANGED
@@ -549,11 +549,13 @@ To use multiple Elasticsearch clusters, specify a connection within your
|
|
549
549
|
indices:
|
550
550
|
|
551
551
|
```ruby
|
552
|
+
MyConnection = SearchFlip::Connection.new(base_url: "http://elasticsearch.host:9200")
|
553
|
+
|
552
554
|
class MyIndex
|
553
555
|
include SearchFlip::Index
|
554
556
|
|
555
557
|
def self.connection
|
556
|
-
|
558
|
+
MyConnection
|
557
559
|
end
|
558
560
|
end
|
559
561
|
```
|
@@ -17,6 +17,7 @@ module SearchFlip
|
|
17
17
|
@base_url = options[:base_url] || SearchFlip::Config[:base_url]
|
18
18
|
@http_client = options[:http_client] || SearchFlip::HTTPClient.new
|
19
19
|
@bulk_limit = options[:bulk_limit] || SearchFlip::Config[:bulk_limit]
|
20
|
+
@version_mutex = Mutex.new
|
20
21
|
end
|
21
22
|
|
22
23
|
# Queries and returns the ElasticSearch version used.
|
@@ -27,7 +28,9 @@ module SearchFlip
|
|
27
28
|
# @return [String] The ElasticSearch version
|
28
29
|
|
29
30
|
def version
|
30
|
-
@
|
31
|
+
@version_mutex.synchronize do
|
32
|
+
@version ||= http_client.headers(accept: "application/json").get("#{base_url}/").parse["version"]["number"]
|
33
|
+
end
|
31
34
|
end
|
32
35
|
|
33
36
|
# Queries and returns the ElasticSearch cluster health.
|
data/lib/search_flip/index.rb
CHANGED
@@ -42,6 +42,8 @@ module SearchFlip
|
|
42
42
|
# CommentIndex.range(:created_at, gt: Time.now - 7.days)
|
43
43
|
|
44
44
|
module Index
|
45
|
+
ConnectionMutex = Mutex.new
|
46
|
+
|
45
47
|
def self.included(base)
|
46
48
|
base.extend ClassMethods
|
47
49
|
end
|
@@ -159,7 +161,7 @@ module SearchFlip
|
|
159
161
|
yield record
|
160
162
|
end
|
161
163
|
else
|
162
|
-
(scope.respond_to?(:each) ? scope : Array(scope)).each do |record|
|
164
|
+
(scope.respond_to?(:each) && !scope.is_a?(SearchFlip::Result) ? scope : Array(scope)).each do |record|
|
163
165
|
yield record
|
164
166
|
end
|
165
167
|
end
|
@@ -636,7 +638,9 @@ module SearchFlip
|
|
636
638
|
# @return [SearchFlip::Connection] The connection
|
637
639
|
|
638
640
|
def connection
|
639
|
-
|
641
|
+
ConnectionMutex.synchronize do
|
642
|
+
@connection ||= SearchFlip::Connection.new(base_url: SearchFlip::Config[:base_url])
|
643
|
+
end
|
640
644
|
end
|
641
645
|
end
|
642
646
|
end
|
data/lib/search_flip/version.rb
CHANGED
data/lib/search_flip.rb
CHANGED
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: 2.1.0.
|
4
|
+
version: 2.1.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: 2019-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|