arelastic 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 425f1a7be6e0fec994a3283b8e3cc9b8b173029e440b085e70c4ae5527e21f28
|
4
|
+
data.tar.gz: fa0fa7ec5b9c51059cd90794fb0c79f1b02c57709a54f227a4966874a7701df9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 142ab29eec840ae2b42ed8692582405e5f89b402929dd4dcc7eebd67045bde4dbf1617e5fb6a705f4aeb403a615017ba0232073f9e51ff88aeca7300b8aeb6de
|
7
|
+
data.tar.gz: ae54f4827a0498e3ef6b3e4098c8e7a161afe563a35fb85921b2c10c45519b69c99012625c9f07b45ae0779bad46b9cfb2354d6435c27004054f9b1c540fa94f
|
data/lib/arelastic/queries.rb
CHANGED
@@ -7,6 +7,7 @@ require 'arelastic/queries/exists'
|
|
7
7
|
require 'arelastic/queries/field'
|
8
8
|
require 'arelastic/queries/filter'
|
9
9
|
require 'arelastic/queries/function_score'
|
10
|
+
require 'arelastic/queries/fuzzy'
|
10
11
|
require 'arelastic/queries/geo_bounding_box'
|
11
12
|
require 'arelastic/queries/geo_distance'
|
12
13
|
require 'arelastic/queries/has_child'
|
@@ -11,11 +11,15 @@ module Arelastic
|
|
11
11
|
def as_elastic
|
12
12
|
{
|
13
13
|
"percolate" => {
|
14
|
-
"field"
|
15
|
-
|
14
|
+
"field" => field,
|
15
|
+
document_parameter_name => document
|
16
16
|
}.merge(options)
|
17
17
|
}
|
18
18
|
end
|
19
|
+
|
20
|
+
def document_parameter_name
|
21
|
+
document.is_a?(Array) ? "documents" : "document"
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -12,6 +12,20 @@ class Arelastic::Queries::PercolateTest < Minitest::Test
|
|
12
12
|
assert_equal expected, percolate.as_elastic
|
13
13
|
end
|
14
14
|
|
15
|
+
def test_as_elastic_with_multiple_documents
|
16
|
+
percolate = Arelastic::Queries::Percolate.new(
|
17
|
+
"query",
|
18
|
+
[{ "color" => "red" }, { "color" => "blue" }]
|
19
|
+
)
|
20
|
+
expected = {
|
21
|
+
"percolate" => {
|
22
|
+
"field" => "query",
|
23
|
+
"documents" => [{ "color" => "red" }, { "color" => "blue" }]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
assert_equal expected, percolate.as_elastic
|
27
|
+
end
|
28
|
+
|
15
29
|
def test_as_elastic_with_options
|
16
30
|
percolate = Arelastic::Queries::Percolate.new("query", {"color" => "red"}, {"document_type" => "widget"})
|
17
31
|
expected = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arelastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Higgins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/arelastic/queries/field.rb
|
65
65
|
- lib/arelastic/queries/filter.rb
|
66
66
|
- lib/arelastic/queries/function_score.rb
|
67
|
+
- lib/arelastic/queries/fuzzy.rb
|
67
68
|
- lib/arelastic/queries/geo_bounding_box.rb
|
68
69
|
- lib/arelastic/queries/geo_distance.rb
|
69
70
|
- lib/arelastic/queries/has_child.rb
|