1<?php 2 3namespace Elastica\Query; 4 5/** 6 * geo_shape query. 7 * 8 * @author Bennie Krijger <benniekrijger@gmail.com> 9 * 10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html 11 */ 12abstract class AbstractGeoShape extends AbstractQuery 13{ 14 /** Return all documents whose geo_shape field intersects the query geometry. (default behavior) */ 15 public const RELATION_INTERSECT = 'intersects'; 16 17 /** Return all documents whose geo_shape field has nothing in common with the query geometry. */ 18 public const RELATION_DISJOINT = 'disjoint'; 19 20 /** Return all documents whose geo_shape field is within the query geometry. */ 21 public const RELATION_WITHIN = 'within'; 22 23 /** Return all documents whose geo_shape field contains the query geometry. */ 24 public const RELATION_CONTAINS = 'contains'; 25 26 /** 27 * Elasticsearch path of the geo_shape field. 28 * 29 * @var string 30 */ 31 protected $_path; 32 33 /** 34 * @var string 35 */ 36 protected $_relation = self::RELATION_INTERSECT; 37 38 /** 39 * Sets the relation of the geo_shape field and the query geometry. 40 * 41 * Possible values: intersects, disjoint, within, contains (see constants). 42 * 43 * @return $this 44 */ 45 public function setRelation(string $relation): self 46 { 47 $this->_relation = $relation; 48 49 return $this; 50 } 51 52 /** 53 * Gets the relation of the geo_shape field and the query geometry. 54 */ 55 public function getRelation(): string 56 { 57 return $this->_relation; 58 } 59} 60