searchkick 4.2.1 → 4.3.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 +5 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +1 -1
- data/lib/searchkick/index.rb +1 -0
- data/lib/searchkick/query.rb +24 -3
- 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: 964d3c57721433fff2893d53c0dd91b60e66f0e0b75c560e71430bc955fac9cb
|
4
|
+
data.tar.gz: 02643d50655602ca36ef006f9f68031b185bcc169a739db0769a7921ba00677f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5d39a9d775e2beac62552cc498447ffd28d71c8f3ddeee6e6a9cb809b07d3a6c50d66d720bfd335d5b349af75f046ccbf4d5fc4cb4e6a0a27ccebaa8cc46daf
|
7
|
+
data.tar.gz: 6a3d30a7d90c7119c4bde98acba3ffc42579524e4ab7a2dbafb2865013d68928d18c2773d17253b42e85ad785c56525203f6843661e78210645fad6dd355ba85
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -4,7 +4,7 @@ First, thanks for wanting to contribute. You’re awesome! :heart:
|
|
4
4
|
|
5
5
|
## Help
|
6
6
|
|
7
|
-
We’re not able to provide support through GitHub Issues. If you’re looking for help with your code, try posting on [Stack Overflow](https://stackoverflow.com/).
|
7
|
+
We’re not able to provide support through GitHub Issues. If you’re looking for help with your code, try posting on [Stack Overflow](https://stackoverflow.com/questions/tagged/searchkick).
|
8
8
|
|
9
9
|
All features should be documented. If you don’t see a feature in the docs, assume it doesn’t exist.
|
10
10
|
|
data/README.md
CHANGED
@@ -137,7 +137,7 @@ Select
|
|
137
137
|
select: [:name]
|
138
138
|
```
|
139
139
|
|
140
|
-
[These source filtering options are supported](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering
|
140
|
+
[These source filtering options are supported](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-source-filtering)
|
141
141
|
|
142
142
|
### Results
|
143
143
|
|
data/lib/searchkick/index.rb
CHANGED
data/lib/searchkick/query.rb
CHANGED
@@ -871,6 +871,11 @@ module Searchkick
|
|
871
871
|
end
|
872
872
|
|
873
873
|
def where_filters(where)
|
874
|
+
# if where.respond_to?(:permitted?) && !where.permitted?
|
875
|
+
# # TODO check in more places
|
876
|
+
# Searchkick.warn("Passing unpermitted parameters will raise an exception in Searchkick 5")
|
877
|
+
# end
|
878
|
+
|
874
879
|
filters = []
|
875
880
|
(where || {}).each do |field, value|
|
876
881
|
field = :_id if field.to_s == "id"
|
@@ -953,10 +958,17 @@ module Searchkick
|
|
953
958
|
# % matches zero or more characters
|
954
959
|
# _ matches one character
|
955
960
|
# \ is escape character
|
956
|
-
|
961
|
+
# escape Lucene reserved characters
|
962
|
+
# https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html#regexp-optional-operators
|
963
|
+
reserved = %w(. ? + * | { } [ ] ( ) " \\)
|
964
|
+
regex = op_value.dup
|
965
|
+
reserved.each do |v|
|
966
|
+
regex.gsub!(v, "\\" + v)
|
967
|
+
end
|
968
|
+
regex = regex.gsub(/(?<!\\)%/, ".*").gsub(/(?<!\\)_/, ".").gsub("\\%", "%").gsub("\\_", "_")
|
957
969
|
filters << {regexp: {field => {value: regex}}}
|
958
970
|
when :prefix
|
959
|
-
filters << {prefix: {field => op_value}}
|
971
|
+
filters << {prefix: {field => {value: op_value}}}
|
960
972
|
when :regexp # support for regexp queries without using a regexp ruby object
|
961
973
|
filters << {regexp: {field => {value: op_value}}}
|
962
974
|
when :not, :_not # not equal
|
@@ -1036,7 +1048,16 @@ module Searchkick
|
|
1036
1048
|
|
1037
1049
|
{regexp: {field => {value: source, flags: "NONE"}}}
|
1038
1050
|
else
|
1039
|
-
|
1051
|
+
# TODO add this for other values
|
1052
|
+
if value.as_json.is_a?(Enumerable)
|
1053
|
+
# query will fail, but this is better
|
1054
|
+
# same message as Active Record
|
1055
|
+
# TODO make TypeError
|
1056
|
+
# raise InvalidQueryError for backward compatibility
|
1057
|
+
raise Searchkick::InvalidQueryError, "can't cast #{value.class.name}"
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
{term: {field => {value: value}}}
|
1040
1061
|
end
|
1041
1062
|
end
|
1042
1063
|
|
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: 4.
|
4
|
+
version: 4.3.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: 2020-
|
11
|
+
date: 2020-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|