searchkick 5.0.5 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/searchkick/middleware.rb +8 -1
- data/lib/searchkick/query.rb +2 -2
- 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: dcb83468ee84892db5a2484a3d5ec75bb9b8964fd0a9b9c3ab73b735f8467390
|
4
|
+
data.tar.gz: d309602fe457bf39fd170d2bcf446119d4a2a93ea669df833b21bf1b0ef76a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196f076e15d708c89ae13ddb96ef7fce4cd19de9b5cfef639ea68e8886e81a66b1f01ed1f5453065ad58c617a42aceeda493ac6bc5c34e89cb08956be35eb87d
|
7
|
+
data.tar.gz: ac58225f370165c19a9378c3c84e07aedc297ae7f263cb1c027f5536184e4fe336b540726e6adf6ac1aca6802e424026a448d783d1e4a4279e03db01931b707c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 5.1.1 (2022-12-05)
|
2
|
+
|
3
|
+
- Added support for strings for `offset` and `per_page`
|
4
|
+
|
5
|
+
## 5.1.0 (2022-10-12)
|
6
|
+
|
7
|
+
- Added support for fractional search timeout
|
8
|
+
- Fixed search timeout with `elasticsearch` 8+ and `opensearch-ruby` gems
|
9
|
+
- Fixed search timeout not applying to `multi_search`
|
10
|
+
|
1
11
|
## 5.0.5 (2022-10-09)
|
2
12
|
|
3
13
|
- Added `model` method to `Searchkick::Relation`
|
data/README.md
CHANGED
@@ -1112,7 +1112,7 @@ Restaurant.search("soup", where: {bounds: {geo_shape: {type: "polygon", coordina
|
|
1112
1112
|
Falling entirely within the query shape
|
1113
1113
|
|
1114
1114
|
```ruby
|
1115
|
-
Restaurant.search("salad", where: {bounds: {geo_shape: {type: "circle", relation: "within", coordinates:
|
1115
|
+
Restaurant.search("salad", where: {bounds: {geo_shape: {type: "circle", relation: "within", coordinates: {lat: 38, lon: -123}, radius: "1km"}}})
|
1116
1116
|
```
|
1117
1117
|
|
1118
1118
|
Not touching the query shape
|
@@ -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
@@ -251,7 +251,7 @@ module Searchkick
|
|
251
251
|
default_limit = searchkick_options[:deep_paging] ? 1_000_000_000 : 10_000
|
252
252
|
per_page = (options[:limit] || options[:per_page] || default_limit).to_i
|
253
253
|
padding = [options[:padding].to_i, 0].max
|
254
|
-
offset = options[:offset] || (page - 1) * per_page + padding
|
254
|
+
offset = (options[:offset] || (page - 1) * per_page + padding).to_i
|
255
255
|
scroll = options[:scroll]
|
256
256
|
|
257
257
|
max_result_window = searchkick_options[:max_result_window]
|
@@ -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.
|
4
|
+
version: 5.1.1
|
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-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|