searchkick 6.0.2 → 6.0.3
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 +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +2 -26
- data/lib/searchkick/index.rb +1 -1
- data/lib/searchkick/index_options.rb +3 -3
- data/lib/searchkick/relation.rb +11 -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: cf43f99e5f6ced971320bdf629e3454e7c8f2fb111c64a0967182ef51aa942d0
|
|
4
|
+
data.tar.gz: a891ac1f9b25f25efc47836887a68a261659fe87e2754cf203f3210b855b2e31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a5a20df662acbcea24702c9a5c22327e54ba9bd223896fcfcc9886fd3087edbbf59b8d806a4248e4f65b7e0df530f90788bf9d54bbce796ec5f267f83fd2caf
|
|
7
|
+
data.tar.gz: 54567b34c84d4444d12d71546d13c2c8569b1dfe710dbe0de0662cde80f16973afe37125c931733787df729bdb853f9c34a66ceb1a094962b84f4c16c79f42af
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 6.0.3 (2026-01-06)
|
|
2
|
+
|
|
3
|
+
- Fixed `inspect` method for `Relation`
|
|
4
|
+
|
|
1
5
|
## 6.0.2 (2025-10-24)
|
|
2
6
|
|
|
3
7
|
- Fixed `as_json` method for `HashWrapper`
|
|
@@ -22,6 +26,7 @@
|
|
|
22
26
|
- Removed default quantization for `knn` option for Elasticsearch 8.14+
|
|
23
27
|
- Removed `results` method (use `to_a` instead)
|
|
24
28
|
- Removed `execute` option and method (no longer needed)
|
|
29
|
+
- Removed `options` method (use individual methods instead)
|
|
25
30
|
- Removed dependency on Hashie
|
|
26
31
|
- Deprecated `conversions` option in favor of `conversions_v2`
|
|
27
32
|
- Dropped support for Elasticsearch 7 and OpenSearch 1
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1182,7 +1182,7 @@ And to search, use:
|
|
|
1182
1182
|
```ruby
|
|
1183
1183
|
Animal.search("*") # all animals
|
|
1184
1184
|
Dog.search("*") # just dogs
|
|
1185
|
-
Animal.search("*").type(
|
|
1185
|
+
Animal.search("*").type(Cat, Dog) # just cats and dogs
|
|
1186
1186
|
```
|
|
1187
1187
|
|
|
1188
1188
|
**Notes:**
|
|
@@ -1547,30 +1547,6 @@ See [Production Rails](https://github.com/ankane/production_rails) for other goo
|
|
|
1547
1547
|
|
|
1548
1548
|
## Performance
|
|
1549
1549
|
|
|
1550
|
-
### JSON Generation
|
|
1551
|
-
|
|
1552
|
-
Increase performance with faster JSON generation. Add to your Gemfile:
|
|
1553
|
-
|
|
1554
|
-
```ruby
|
|
1555
|
-
gem "json", ">= 2.10.2"
|
|
1556
|
-
```
|
|
1557
|
-
|
|
1558
|
-
And create an initializer with:
|
|
1559
|
-
|
|
1560
|
-
```ruby
|
|
1561
|
-
class SearchSerializer
|
|
1562
|
-
CODER = JSON::Coder.new { |v, _| v.is_a?(Time) ? v.as_json : v }
|
|
1563
|
-
|
|
1564
|
-
def dump(object)
|
|
1565
|
-
CODER.generate(object)
|
|
1566
|
-
end
|
|
1567
|
-
end
|
|
1568
|
-
|
|
1569
|
-
Elasticsearch::API.settings[:serializer] = SearchSerializer.new
|
|
1570
|
-
# or
|
|
1571
|
-
OpenSearch::API.settings[:serializer] = SearchSerializer.new
|
|
1572
|
-
```
|
|
1573
|
-
|
|
1574
1550
|
### Persistent HTTP Connections
|
|
1575
1551
|
|
|
1576
1552
|
Significantly increase performance with persistent HTTP connections. Add [Typhoeus](https://github.com/typhoeus/typhoeus) to your Gemfile and it’ll automatically be used.
|
|
@@ -2311,7 +2287,7 @@ Product.search("apples").where(in_stock: true).limit(10).offset(50)
|
|
|
2311
2287
|
|
|
2312
2288
|
All existing options can be used as methods, or you can continue to use the existing API.
|
|
2313
2289
|
|
|
2314
|
-
This release also significantly improves the performance of searches when using conversions. To upgrade without downtime, add `conversions_v2` to your model and an additional field to `search_data`:
|
|
2290
|
+
This release also significantly improves the performance of searches when using conversions. To upgrade conversions without downtime, add `conversions_v2` to your model and an additional field to `search_data`:
|
|
2315
2291
|
|
|
2316
2292
|
```ruby
|
|
2317
2293
|
class Product < ApplicationRecord
|
data/lib/searchkick/index.rb
CHANGED
|
@@ -359,7 +359,7 @@ module Searchkick
|
|
|
359
359
|
end
|
|
360
360
|
|
|
361
361
|
# https://gist.github.com/jarosan/3124884
|
|
362
|
-
#
|
|
362
|
+
# https://www.elastic.co/blog/changing-mapping-with-zero-downtime/
|
|
363
363
|
def full_reindex(relation, import: true, resume: false, retain: false, mode: nil, refresh_interval: nil, scope: nil, wait: nil, job_options: nil)
|
|
364
364
|
raise ArgumentError, "wait only available in :async mode" if !wait.nil? && mode != :async
|
|
365
365
|
raise ArgumentError, "Full reindex does not support :queue mode - use :async mode instead" if mode == :queue
|
|
@@ -524,7 +524,7 @@ module Searchkick
|
|
|
524
524
|
|
|
525
525
|
dynamic_fields = {
|
|
526
526
|
# analyzed field must be the default field for include_in_all
|
|
527
|
-
#
|
|
527
|
+
# https://www.elastic.co/guide/reference/mapping/multi-field-type/
|
|
528
528
|
# however, we can include the not_analyzed field in _all
|
|
529
529
|
# and the _all index analyzer will take care of it
|
|
530
530
|
"{name}" => keyword_mapping
|
|
@@ -544,7 +544,7 @@ module Searchkick
|
|
|
544
544
|
end
|
|
545
545
|
end
|
|
546
546
|
|
|
547
|
-
#
|
|
547
|
+
# https://www.elastic.co/guide/reference/mapping/multi-field-type/
|
|
548
548
|
multi_field = dynamic_fields["{name}"].merge(fields: dynamic_fields.except("{name}"))
|
|
549
549
|
|
|
550
550
|
mappings = {
|
|
@@ -578,7 +578,7 @@ module Searchkick
|
|
|
578
578
|
# https://groups.google.com/forum/#!topic/elasticsearch/p7qcQlgHdB8
|
|
579
579
|
# TODO use a snowball stemmer on synonyms when creating the token filter
|
|
580
580
|
|
|
581
|
-
#
|
|
581
|
+
# https://discuss.elastic.co/t/synonym-multi-words-search/10964
|
|
582
582
|
# I find the following approach effective if you are doing multi-word synonyms (synonym phrases):
|
|
583
583
|
# - Only apply the synonym expansion at index time
|
|
584
584
|
# - Don't have the synonym filter applied search
|
data/lib/searchkick/relation.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Searchkick
|
|
|
22
22
|
|
|
23
23
|
# same as Active Record
|
|
24
24
|
def inspect
|
|
25
|
-
entries =
|
|
25
|
+
entries = private_execute.first(11).map!(&:inspect)
|
|
26
26
|
entries[10] = "..." if entries.size == 11
|
|
27
27
|
"#<#{self.class.name} [#{entries.join(', ')}]>"
|
|
28
28
|
end
|
|
@@ -644,6 +644,16 @@ module Searchkick
|
|
|
644
644
|
Results.new(nil, nil, nil).respond_to?(...) || super
|
|
645
645
|
end
|
|
646
646
|
|
|
647
|
+
# TODO uncomment in 7.0
|
|
648
|
+
# def to_json(...)
|
|
649
|
+
# private_execute.to_a.to_json(...)
|
|
650
|
+
# end
|
|
651
|
+
|
|
652
|
+
# TODO uncomment in 7.0
|
|
653
|
+
# def as_json(...)
|
|
654
|
+
# private_execute.to_a.as_json(...)
|
|
655
|
+
# end
|
|
656
|
+
|
|
647
657
|
def to_yaml
|
|
648
658
|
private_execute.to_a.to_yaml
|
|
649
659
|
end
|
data/lib/searchkick/version.rb
CHANGED
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.0.
|
|
4
|
+
version: 6.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
78
|
version: '0'
|
|
79
79
|
requirements: []
|
|
80
|
-
rubygems_version:
|
|
80
|
+
rubygems_version: 4.0.3
|
|
81
81
|
specification_version: 4
|
|
82
82
|
summary: Intelligent search made easy with Rails and Elasticsearch or OpenSearch
|
|
83
83
|
test_files: []
|