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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a93f95464f2b83d27f621d925326ea3b7728b2d71fff9831e20e07658ff0466
4
- data.tar.gz: acf15b38474dea853f3e3574ea5fac21d4129920b6365e2c92ca58cfaf518cc0
3
+ metadata.gz: 4f8772937f9490975f3e21a5dbd7e2ddc18da42959a42a991875e4d04caca549
4
+ data.tar.gz: c10ee19a6feb618cc6d84da994053ed3996b97aaeac85d2c6510246ba4dfd7cf
5
5
  SHA512:
6
- metadata.gz: 51f9d3b6c110a7ec24988518b7e154fef368c2d027c00337e54096c3214871d29da9bdc9e549d4b9967742636bb8ae60d5a288ca066ff992691692a017b9bdda
7
- data.tar.gz: 811825c1043231828c2d04a3a2081e453440fd470563680c8e470fea00569ffe57109bca64e07978ba8944d53a03f95c9fd4768872d6bf2ae6c4e87ede961e7a
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
- if env[:method] == :get && env[:url].path.to_s.end_with?("/_search")
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
@@ -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}s"
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
@@ -1,3 +1,3 @@
1
1
  module Searchkick
2
- VERSION = "5.0.5"
2
+ VERSION = "5.1.0"
3
3
  end
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.5
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-10 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel