arelastic 2.6.0 → 2.7.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f5e855197587936d7baf26b9837755dcaa09f2b7ad699bbf1bcf57c76b60e5e
|
4
|
+
data.tar.gz: b73a52f93c29c90800a474c6be6542d1668419e91779621fdae1887c5971ca36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe1729db0993d883346531353b57d8ffce55e5af76f29c668c6f7ce84ada4b25a3ca20eb49e02853083f809107d8664099dedffccdc40c2c7f04584367e0039
|
7
|
+
data.tar.gz: d2ca4b464fda341996935aabc3b90b690442e682e735deb7022a2df82428ec81cff2ac67b71057f76904d821c4f22d7f832217e64674cddf0bcd94ac64848782
|
@@ -12,6 +12,7 @@ module Arelastic
|
|
12
12
|
fuzzy: Arelastic::Queries::Fuzzy,
|
13
13
|
geo_bounding_box: Arelastic::Queries::GeoBoundingBox,
|
14
14
|
geo_distance: Arelastic::Queries::GeoDistance,
|
15
|
+
geo_polygon: Arelastic::Queries::GeoPolygon,
|
15
16
|
has_child: Arelastic::Queries::HasChild,
|
16
17
|
ids: Arelastic::Queries::Ids,
|
17
18
|
limit: Arelastic::Queries::Limit,
|
data/lib/arelastic/queries.rb
CHANGED
@@ -10,6 +10,7 @@ require 'arelastic/queries/function_score'
|
|
10
10
|
require 'arelastic/queries/fuzzy'
|
11
11
|
require 'arelastic/queries/geo_bounding_box'
|
12
12
|
require 'arelastic/queries/geo_distance'
|
13
|
+
require 'arelastic/queries/geo_polygon'
|
13
14
|
require 'arelastic/queries/has_child'
|
14
15
|
require 'arelastic/queries/ids'
|
15
16
|
require 'arelastic/queries/limit'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Arelastic
|
2
|
+
module Queries
|
3
|
+
class GeoPolygon < Arelastic::Queries::Query
|
4
|
+
attr_accessor :field, :points, :options
|
5
|
+
def initialize(field, points, options = {})
|
6
|
+
@field = field
|
7
|
+
@points = points
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def as_elastic
|
12
|
+
params = {field => {"points" => points}}.update(options)
|
13
|
+
|
14
|
+
{ "geo_polygon" => params }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Queries::GeoDistanceTest < Minitest::Test
|
4
|
+
def test_as_elastic
|
5
|
+
points = [
|
6
|
+
{"lat" => 47.15, "lon" => -124.33},
|
7
|
+
{"lat" => 46.63, "lon" => -124.42},
|
8
|
+
{"lat" => 46.15, "lon" => -123.84}
|
9
|
+
]
|
10
|
+
expected = {
|
11
|
+
"geo_polygon" => {
|
12
|
+
"person.location" => {
|
13
|
+
"points" => points
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
assert_equal expected, Arelastic::Queries::GeoPolygon.new('person.location', points).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.
|
4
|
+
version: 2.7.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:
|
11
|
+
date: 2019-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/arelastic/queries/fuzzy.rb
|
69
69
|
- lib/arelastic/queries/geo_bounding_box.rb
|
70
70
|
- lib/arelastic/queries/geo_distance.rb
|
71
|
+
- lib/arelastic/queries/geo_polygon.rb
|
71
72
|
- lib/arelastic/queries/has_child.rb
|
72
73
|
- lib/arelastic/queries/ids.rb
|
73
74
|
- lib/arelastic/queries/limit.rb
|
@@ -131,6 +132,7 @@ files:
|
|
131
132
|
- test/arelastic/queries/function_score_test.rb
|
132
133
|
- test/arelastic/queries/geo_bounding_box_test.rb
|
133
134
|
- test/arelastic/queries/geo_distance_test.rb
|
135
|
+
- test/arelastic/queries/geo_polygon_test.rb
|
134
136
|
- test/arelastic/queries/has_child_test.rb
|
135
137
|
- test/arelastic/queries/ids_test.rb
|
136
138
|
- test/arelastic/queries/match_all_test.rb
|
@@ -171,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
173
|
version: '0'
|
172
174
|
requirements: []
|
173
175
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.7.
|
176
|
+
rubygems_version: 2.7.6
|
175
177
|
signing_key:
|
176
178
|
specification_version: 4
|
177
179
|
summary: Elastic Search query builder
|