arelastic 2.4.1 → 2.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb1b9ff52106f04b72dbe79ab103f853951ef7e8e9a4a23d6f7e1af1add83013
4
- data.tar.gz: bcf8854486763769a929e5fc1b0d9826098feb5ca22b05601dc5a20ec28b08bb
3
+ metadata.gz: 425f1a7be6e0fec994a3283b8e3cc9b8b173029e440b085e70c4ae5527e21f28
4
+ data.tar.gz: fa0fa7ec5b9c51059cd90794fb0c79f1b02c57709a54f227a4966874a7701df9
5
5
  SHA512:
6
- metadata.gz: c6bee6d6b9a889d2af4e41de061068b1c7f574f6ec6e98a8b8add6e1b213a55994ef3cf42851fa1507f382f1f53089d94907f0582512b0cbaee268a48b346fda
7
- data.tar.gz: 73da8e19fb9c8c072d122c16a109b1426cdedd8787255e8dd785e64b3fa0d220fecf1388ae5fcd3e8274c39aeac772211a1e431fac5b8828b3f3c8eef348e8b6
6
+ metadata.gz: 142ab29eec840ae2b42ed8692582405e5f89b402929dd4dcc7eebd67045bde4dbf1617e5fb6a705f4aeb403a615017ba0232073f9e51ff88aeca7300b8aeb6de
7
+ data.tar.gz: ae54f4827a0498e3ef6b3e4098c8e7a161afe563a35fb85921b2c10c45519b69c99012625c9f07b45ae0779bad46b9cfb2354d6435c27004054f9b1c540fa94f
@@ -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'
@@ -0,0 +1,7 @@
1
+ module Arelastic
2
+ module Queries
3
+ class Fuzzy < Arelastic::Queries::Query
4
+ binary 'fuzzy'
5
+ end
6
+ end
7
+ end
@@ -11,11 +11,15 @@ module Arelastic
11
11
  def as_elastic
12
12
  {
13
13
  "percolate" => {
14
- "field" => field,
15
- "document" => document
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.1
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-07-06 00:00:00.000000000 Z
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