From 6e2cb00008cbf09e556b00f87603797fcaa47e09 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 16 Apr 2018 05:37:14 -0700 Subject: Depenancy upgrades and movign to dep. (#8630) --- .../olivere/elastic/search_queries_geo_polygon.go | 72 ---------------------- 1 file changed, 72 deletions(-) delete mode 100644 vendor/github.com/olivere/elastic/search_queries_geo_polygon.go (limited to 'vendor/github.com/olivere/elastic/search_queries_geo_polygon.go') diff --git a/vendor/github.com/olivere/elastic/search_queries_geo_polygon.go b/vendor/github.com/olivere/elastic/search_queries_geo_polygon.go deleted file mode 100644 index 7678c3f3b..000000000 --- a/vendor/github.com/olivere/elastic/search_queries_geo_polygon.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2012-present Oliver Eilhard. All rights reserved. -// Use of this source code is governed by a MIT-license. -// See http://olivere.mit-license.org/license.txt for details. - -package elastic - -// GeoPolygonQuery allows to include hits that only fall within a polygon of points. -// -// For more details, see: -// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/query-dsl-geo-polygon-query.html -type GeoPolygonQuery struct { - name string - points []*GeoPoint - queryName string -} - -// NewGeoPolygonQuery creates and initializes a new GeoPolygonQuery. -func NewGeoPolygonQuery(name string) *GeoPolygonQuery { - return &GeoPolygonQuery{ - name: name, - points: make([]*GeoPoint, 0), - } -} - -// AddPoint adds a point from latitude and longitude. -func (q *GeoPolygonQuery) AddPoint(lat, lon float64) *GeoPolygonQuery { - q.points = append(q.points, GeoPointFromLatLon(lat, lon)) - return q -} - -// AddGeoPoint adds a GeoPoint. -func (q *GeoPolygonQuery) AddGeoPoint(point *GeoPoint) *GeoPolygonQuery { - q.points = append(q.points, point) - return q -} - -func (q *GeoPolygonQuery) QueryName(queryName string) *GeoPolygonQuery { - q.queryName = queryName - return q -} - -// Source returns JSON for the function score query. -func (q *GeoPolygonQuery) Source() (interface{}, error) { - // "geo_polygon" : { - // "person.location" : { - // "points" : [ - // {"lat" : 40, "lon" : -70}, - // {"lat" : 30, "lon" : -80}, - // {"lat" : 20, "lon" : -90} - // ] - // } - // } - source := make(map[string]interface{}) - - params := make(map[string]interface{}) - source["geo_polygon"] = params - - polygon := make(map[string]interface{}) - params[q.name] = polygon - - var points []interface{} - for _, point := range q.points { - points = append(points, point.Source()) - } - polygon["points"] = points - - if q.queryName != "" { - params["_name"] = q.queryName - } - - return source, nil -} -- cgit v1.2.3-1-g7c22