searchkick 5.0.5 → 5.1.0
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/CHANGELOG.md +6 -0
- data/lib/searchkick/middleware.rb +8 -1
- data/lib/searchkick/query.rb +1 -1
- data/lib/searchkick/version.rb +1 -1
- 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: 4f8772937f9490975f3e21a5dbd7e2ddc18da42959a42a991875e4d04caca549
|
4
|
+
data.tar.gz: c10ee19a6feb618cc6d84da994053ed3996b97aaeac85d2c6510246ba4dfd7cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6e13f2d84a1869b912732befa604da472a020a5862e8387916bc1c8fb57e24f23a899d774d043f5af2a93856b25278f618e16ffd177a7fe035844660dfc1723
|
7
|
+
data.tar.gz: 53b5c913f753a9f8c0ef2d2de3c7f1c2fd21c5a456919a453d0f48f8a891b73e57e0746d30d669c0d0d0f89c4cd174559a616d715aee4b6dc55aa627a420963e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 5.1.0 (2022-10-12)
|
2
|
+
|
3
|
+
- Added support for fractional search timeout
|
4
|
+
- Fixed search timeout with `elasticsearch` 8+ and `opensearch-ruby` gems
|
5
|
+
- Fixed search timeout not applying to `multi_search`
|
6
|
+
|
1
7
|
## 5.0.5 (2022-10-09)
|
2
8
|
|
3
9
|
- Added `model` method to `Searchkick::Relation`
|
@@ -3,8 +3,15 @@ require "faraday"
|
|
3
3
|
module Searchkick
|
4
4
|
class Middleware < Faraday::Middleware
|
5
5
|
def call(env)
|
6
|
-
|
6
|
+
path = env[:url].path.to_s
|
7
|
+
if path.end_with?("/_search")
|
7
8
|
env[:request][:timeout] = Searchkick.search_timeout
|
9
|
+
elsif path.end_with?("/_msearch")
|
10
|
+
# assume no concurrent searches for timeout for now
|
11
|
+
searches = env[:request_body].count("\n") / 2
|
12
|
+
# do not allow timeout to exceed Searchkick.timeout
|
13
|
+
timeout = [Searchkick.search_timeout * searches, Searchkick.timeout].min
|
14
|
+
env[:request][:timeout] = timeout
|
8
15
|
end
|
9
16
|
@app.call(env)
|
10
17
|
end
|
data/lib/searchkick/query.rb
CHANGED
@@ -505,7 +505,7 @@ module Searchkick
|
|
505
505
|
set_highlights(payload, fields) if options[:highlight]
|
506
506
|
|
507
507
|
# timeout shortly after client times out
|
508
|
-
payload[:timeout] ||= "#{Searchkick.search_timeout + 1}
|
508
|
+
payload[:timeout] ||= "#{((Searchkick.search_timeout + 1) * 1000).round}ms"
|
509
509
|
|
510
510
|
# An empty array will cause only the _id and _type for each hit to be returned
|
511
511
|
# https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html
|
data/lib/searchkick/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchkick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|