|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Solarium\QueryType\Select\Query\Component; |
| 4 | + |
| 5 | +use Solarium\QueryType\Select\Query\Query as SelectQuery; |
| 6 | +use Solarium\QueryType\Select\RequestBuilder\Component\Spatial as RequestBuilder; |
| 7 | + |
| 8 | +/** |
| 9 | + * Spatial component. |
| 10 | + * |
| 11 | + * @link https://cwiki.apache.org/confluence/display/solr/Spatial+Search |
| 12 | + */ |
| 13 | +class Spatial extends AbstractComponent |
| 14 | +{ |
| 15 | + /** |
| 16 | + * Get component type. |
| 17 | + * |
| 18 | + * @return string |
| 19 | + */ |
| 20 | + public function getType() |
| 21 | + { |
| 22 | + return SelectQuery::COMPONENT_SPATIAL; |
| 23 | + } |
| 24 | + |
| 25 | + /** |
| 26 | + * Get a requestbuilder for this query. |
| 27 | + * |
| 28 | + * @return RequestBuilder |
| 29 | + */ |
| 30 | + public function getRequestBuilder() |
| 31 | + { |
| 32 | + return new RequestBuilder(); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * This component has no response parser... |
| 37 | + */ |
| 38 | + public function getResponseParser() |
| 39 | + { |
| 40 | + return; |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * @param string $sfield |
| 45 | + */ |
| 46 | + public function setField($sfield) |
| 47 | + { |
| 48 | + $this->setOption('sfield', $sfield); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * @param int $distance |
| 53 | + */ |
| 54 | + public function setDistance($distance) |
| 55 | + { |
| 56 | + $this->setOption('d', $distance); |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * @param string $point |
| 61 | + */ |
| 62 | + public function setPoint($point) |
| 63 | + { |
| 64 | + $this->setOption('pt', $point); |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Get sfield option. |
| 69 | + * |
| 70 | + * @return string|null |
| 71 | + */ |
| 72 | + public function getField() |
| 73 | + { |
| 74 | + return $this->getOption('sfield'); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Get d option. |
| 79 | + * |
| 80 | + * @return int|null |
| 81 | + */ |
| 82 | + public function getDistance() |
| 83 | + { |
| 84 | + return $this->getOption('d'); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Get pt option. |
| 89 | + * |
| 90 | + * @return int|null |
| 91 | + */ |
| 92 | + public function getPoint() |
| 93 | + { |
| 94 | + return $this->getOption('pt'); |
| 95 | + } |
| 96 | +} |
0 commit comments