1<?php
2
3namespace Elastica\Query;
4
5/**
6 * Distance feature query.
7 *
8 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-distance-feature-query.html
9 */
10class DistanceFeature extends AbstractQuery
11{
12    public function __construct(string $field, $origin, string $pivot)
13    {
14        $this->setField($field);
15        $this->setOrigin($origin);
16        $this->setPivot($pivot);
17    }
18
19    public function setField(string $field): self
20    {
21        return $this->setParam('field', $field);
22    }
23
24    /**
25     * @param array|string $origin
26     */
27    public function setOrigin($origin): self
28    {
29        return $this->setParam('origin', $origin);
30    }
31
32    public function setPivot(string $pivot): self
33    {
34        return $this->setParam('pivot', $pivot);
35    }
36
37    public function setBoost(float $boost = 1.0): self
38    {
39        return $this->setParam('boost', $boost);
40    }
41}
42