searchkick 6.1.1 → 6.2.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 +11 -0
- data/README.md +1 -3
- data/lib/searchkick/indexer.rb +1 -1
- data/lib/searchkick/multi_search.rb +1 -1
- data/lib/searchkick/query.rb +3 -2
- data/lib/searchkick/record_indexer.rb +1 -1
- data/lib/searchkick/relation.rb +2 -2
- data/lib/searchkick/results.rb +2 -2
- data/lib/searchkick/version.rb +1 -1
- data/lib/searchkick.rb +16 -0
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2121e032be84fa384237ffc463e742a715ce154d93c43cbbd26513f502a528f2
|
|
4
|
+
data.tar.gz: 7f84359f3aa297e194fc6d106fc1716e269c03f20a792da8f44bacdeb4fe5a3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45f86871453027c8ec325e7a3c9bab2562b6e4ec41a5b3f05fb1c844bf94fe292c42305800323e67ab46173825f38d02e8a2ff78830c448e013ab45d58357998
|
|
7
|
+
data.tar.gz: a048dbde715b327464b5f7e795f8d534e4e87d8ad150700d0a820848d0756fb46f7d8e932fef7b191a176a44c37ffa0bc49d7db1baea6cfc72dd1b2ef3144310
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 6.2.0 (2026-10-27)
|
|
2
|
+
|
|
3
|
+
- Added support for `opensearch-ruby` 4 gem (in beta)
|
|
4
|
+
- Fixed error with `highlight` method and no arguments
|
|
5
|
+
- Fixed async reindex for inherited models when changing type
|
|
6
|
+
- Dropped support for Ruby < 3.3 and Active Record < 8
|
|
7
|
+
|
|
8
|
+
## 6.1.2 (2026-06-04)
|
|
9
|
+
|
|
10
|
+
- Fixed `too_long_http_line_exception` with `clear_scroll` method
|
|
11
|
+
|
|
1
12
|
## 6.1.1 (2026-05-14)
|
|
2
13
|
|
|
3
14
|
- Fixed smart aggs behavior with `_and`
|
data/README.md
CHANGED
|
@@ -43,8 +43,6 @@ Check out [Searchjoy](https://github.com/ankane/searchjoy) for analytics and [Au
|
|
|
43
43
|
- [Reference](#reference)
|
|
44
44
|
- [Contributing](#contributing)
|
|
45
45
|
|
|
46
|
-
Searchkick 6.0 was recently released! See [how to upgrade](#upgrading)
|
|
47
|
-
|
|
48
46
|
## Getting Started
|
|
49
47
|
|
|
50
48
|
Install [Elasticsearch](https://www.elastic.co/downloads/elasticsearch) or [OpenSearch](https://opensearch.org/downloads.html). For Homebrew, use:
|
|
@@ -1589,7 +1587,7 @@ For large data sets, you can use background jobs to parallelize reindexing.
|
|
|
1589
1587
|
|
|
1590
1588
|
```ruby
|
|
1591
1589
|
Product.reindex(mode: :async)
|
|
1592
|
-
# {index_name: "
|
|
1590
|
+
# {index_name: "products_production_20260111210018065"}
|
|
1593
1591
|
```
|
|
1594
1592
|
|
|
1595
1593
|
Once the jobs complete, promote the new index with:
|
data/lib/searchkick/indexer.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Searchkick
|
|
|
19
19
|
|
|
20
20
|
return if items.empty?
|
|
21
21
|
|
|
22
|
-
response = Searchkick.client.bulk(body: items)
|
|
22
|
+
response = Searchkick.client.bulk(body: Searchkick.opensearch4_client? ? items.as_json : items)
|
|
23
23
|
if response["errors"]
|
|
24
24
|
# note: delete does not set error when item not found
|
|
25
25
|
first_with_error = response["items"].map do |item|
|
|
@@ -19,7 +19,7 @@ module Searchkick
|
|
|
19
19
|
params = {
|
|
20
20
|
body: search_queries.flat_map { |q| [q.params.except(:body), q.body] }
|
|
21
21
|
}
|
|
22
|
-
params
|
|
22
|
+
Searchkick.add_opaque_id(params, @opaque_id) if @opaque_id
|
|
23
23
|
responses = client.msearch(params)["responses"]
|
|
24
24
|
|
|
25
25
|
retry_queries = []
|
data/lib/searchkick/query.rb
CHANGED
|
@@ -94,7 +94,7 @@ module Searchkick
|
|
|
94
94
|
params[:type] = @type if @type
|
|
95
95
|
params[:routing] = @routing if @routing
|
|
96
96
|
params[:scroll] = @scroll if @scroll
|
|
97
|
-
params
|
|
97
|
+
Searchkick.add_opaque_id(params, @opaque_id) if @opaque_id
|
|
98
98
|
params.merge!(options[:request_params]) if options[:request_params]
|
|
99
99
|
params
|
|
100
100
|
end
|
|
@@ -225,12 +225,13 @@ module Searchkick
|
|
|
225
225
|
|
|
226
226
|
def execute_search
|
|
227
227
|
name = searchkick_klass ? "#{searchkick_klass.name} Search" : "Search"
|
|
228
|
+
params = params()
|
|
228
229
|
event = {
|
|
229
230
|
name: name,
|
|
230
231
|
query: params
|
|
231
232
|
}
|
|
232
233
|
ActiveSupport::Notifications.instrument("search.searchkick", event) do
|
|
233
|
-
Searchkick.client.search(params)
|
|
234
|
+
Searchkick.client.search(Searchkick.opensearch4_client? ? params.as_json : params)
|
|
234
235
|
end
|
|
235
236
|
end
|
|
236
237
|
|
data/lib/searchkick/relation.rb
CHANGED
|
@@ -222,11 +222,11 @@ module Searchkick
|
|
|
222
222
|
self
|
|
223
223
|
end
|
|
224
224
|
|
|
225
|
-
def highlight(value)
|
|
225
|
+
def highlight(value = true)
|
|
226
226
|
clone.highlight!(value)
|
|
227
227
|
end
|
|
228
228
|
|
|
229
|
-
def highlight!(value)
|
|
229
|
+
def highlight!(value = true)
|
|
230
230
|
check_loaded
|
|
231
231
|
@options[:highlight] = value
|
|
232
232
|
self
|
data/lib/searchkick/results.rb
CHANGED
|
@@ -191,7 +191,7 @@ module Searchkick
|
|
|
191
191
|
scroll: options[:scroll],
|
|
192
192
|
body: {scroll_id: scroll_id}
|
|
193
193
|
}
|
|
194
|
-
params
|
|
194
|
+
Searchkick.add_opaque_id(params, options[:opaque_id]) if options[:opaque_id]
|
|
195
195
|
Results.new(@klass, Searchkick.client.scroll(params), @options)
|
|
196
196
|
rescue => e
|
|
197
197
|
if Searchkick.not_found_error?(e) && e.message =~ /search_context_missing_exception/i
|
|
@@ -208,7 +208,7 @@ module Searchkick
|
|
|
208
208
|
# try to clear scroll
|
|
209
209
|
# not required as scroll will expire
|
|
210
210
|
# but there is a cost to open scrolls
|
|
211
|
-
Searchkick.client.clear_scroll(scroll_id: scroll_id)
|
|
211
|
+
Searchkick.client.clear_scroll({body: {scroll_id: scroll_id}})
|
|
212
212
|
rescue => e
|
|
213
213
|
raise e unless Searchkick.transport_error?(e)
|
|
214
214
|
end
|
data/lib/searchkick/version.rb
CHANGED
data/lib/searchkick.rb
CHANGED
|
@@ -133,6 +133,13 @@ module Searchkick
|
|
|
133
133
|
@opensearch
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
+
def self.opensearch4_client?
|
|
137
|
+
unless defined?(@opensearch4_client)
|
|
138
|
+
@opensearch4_client = defined?(OpenSearch) && OpenSearch::VERSION.to_i >= 4 && client.is_a?(OpenSearch::Client)
|
|
139
|
+
end
|
|
140
|
+
@opensearch4_client
|
|
141
|
+
end
|
|
142
|
+
|
|
136
143
|
def self.server_below?(version)
|
|
137
144
|
Gem::Version.new(server_version.split("-")[0]) < Gem::Version.new(version.split("-")[0])
|
|
138
145
|
end
|
|
@@ -351,6 +358,15 @@ module Searchkick
|
|
|
351
358
|
end
|
|
352
359
|
end
|
|
353
360
|
|
|
361
|
+
# private
|
|
362
|
+
def self.add_opaque_id(params, opaque_id)
|
|
363
|
+
if opensearch4_client?
|
|
364
|
+
(params[:headers] ||= {}).merge!("X-Opaque-Id" => opaque_id)
|
|
365
|
+
else
|
|
366
|
+
params[:opaque_id] = opaque_id
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
|
|
354
370
|
# private
|
|
355
371
|
def self.not_found_error?(e)
|
|
356
372
|
(defined?(Elastic::Transport) && e.is_a?(Elastic::Transport::Transport::Errors::NotFound)) ||
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: searchkick
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '8'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '8'
|
|
26
26
|
email: andrew@ankane.org
|
|
27
27
|
executables: []
|
|
28
28
|
extensions: []
|
|
@@ -70,14 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
70
70
|
requirements:
|
|
71
71
|
- - ">="
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: '3.
|
|
73
|
+
version: '3.3'
|
|
74
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
requirements:
|
|
76
76
|
- - ">="
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
78
|
version: '0'
|
|
79
79
|
requirements: []
|
|
80
|
-
rubygems_version: 4.0.
|
|
80
|
+
rubygems_version: 4.0.20
|
|
81
81
|
specification_version: 4
|
|
82
82
|
summary: Intelligent search made easy with Rails and Elasticsearch or OpenSearch
|
|
83
83
|
test_files: []
|