AbstractGeoShape.php 1.5 KB

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