arelastic 2.7.0 → 2.8.0

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: 4f5e855197587936d7baf26b9837755dcaa09f2b7ad699bbf1bcf57c76b60e5e
4
- data.tar.gz: b73a52f93c29c90800a474c6be6542d1668419e91779621fdae1887c5971ca36
3
+ metadata.gz: af4023400c1d257502730aac57b6ce84c98fd24616a1b46be924f61554c5c243
4
+ data.tar.gz: cc7c793bed539affe141f675cdd507ebe92c65bb0f221095e9870bb1c1229714
5
5
  SHA512:
6
- metadata.gz: 9fe1729db0993d883346531353b57d8ffce55e5af76f29c668c6f7ce84ada4b25a3ca20eb49e02853083f809107d8664099dedffccdc40c2c7f04584367e0039
7
- data.tar.gz: d2ca4b464fda341996935aabc3b90b690442e682e735deb7022a2df82428ec81cff2ac67b71057f76904d821c4f22d7f832217e64674cddf0bcd94ac64848782
6
+ metadata.gz: 294e5fdfe4f87a3051f1e02cb80ab26c328ed0edf22542a9b05ff2ddbb1c6dc18f1227fd1290d294bf9a39f35d3ff9acd986c55630d567614b49faf4106914e6
7
+ data.tar.gz: 365ec409f5586f3df3c4f606dc9a6734c5db370035d6cb7bba2295e9216f6e0b9f4f460a680f089d332fa04f94a65ee594c4d7e0fe63f22d50845d04a49b68a2
@@ -1,21 +1,22 @@
1
1
  module Arelastic
2
2
  module Queries
3
3
  class Nested < Arelastic::Queries::Query
4
- attr_accessor :path, :expr
4
+ attr_accessor :path, :query, :options
5
5
 
6
- def initialize(path, expr)
7
- @path = path
8
- @expr = expr
6
+ def initialize(path, query, options = {})
7
+ @path = path
8
+ @query = query
9
+ @options = options
9
10
  end
10
11
 
11
12
  def as_elastic
12
13
  params = {
13
14
  'path' => path,
14
- 'query' => convert_to_elastic(expr)
15
- }
15
+ 'query' => convert_to_elastic(query)
16
+ }.update(options)
16
17
 
17
18
  { 'nested' => params }
18
19
  end
19
20
  end
20
21
  end
21
- end
22
+ end
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class Arelastic::Queries::GeoDistanceTest < Minitest::Test
3
+ class Arelastic::Queries::GeoPolygonTest < Minitest::Test
4
4
  def test_as_elastic
5
5
  points = [
6
6
  {"lat" => 47.15, "lon" => -124.33},
@@ -0,0 +1,20 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Queries::NestedTest < Minitest::Test
4
+ def test_as_elastic
5
+ expected = {
6
+ 'nested' => {
7
+ 'path' => 'comments',
8
+ 'query' => {
9
+ 'match' => {
10
+ 'author'=>'matt'
11
+ }
12
+ },
13
+ 'inner_hits' => {}
14
+ }
15
+ }
16
+
17
+ query = Arelastic::Queries::Match.new('author', 'matt')
18
+ assert_equal expected, Arelastic::Queries::Nested.new('comments', query, 'inner_hits' => {}).as_elastic
19
+ end
20
+ end
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.7.0
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Higgins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-28 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -140,6 +140,7 @@ files:
140
140
  - test/arelastic/queries/match_phrase_test.rb
141
141
  - test/arelastic/queries/match_test.rb
142
142
  - test/arelastic/queries/multi_match_test.rb
143
+ - test/arelastic/queries/nested_test.rb
143
144
  - test/arelastic/queries/percolate_test.rb
144
145
  - test/arelastic/queries/query_string_test.rb
145
146
  - test/arelastic/queries/query_test.rb
@@ -172,8 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  - !ruby/object:Gem::Version
173
174
  version: '0'
174
175
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.6
176
+ rubygems_version: 3.0.3
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Elastic Search query builder