Issues (17)

lib/Query/Compound/DisMaxQuery.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace olvlvl\ElasticsearchDSL\Query\Compound;
4
5
use olvlvl\ElasticsearchDSL\Query\Option\BoostOption;
6
use olvlvl\ElasticsearchDSL\Query\Option\HasBoostOption;
7
use olvlvl\ElasticsearchDSL\Query\QueryAbstract;
8
use olvlvl\ElasticsearchDSL\Query\QueryCollection;
9
10
/**
11
 * @property-read QueryCollection $queries
12
 */
13
class DisMaxQuery extends QueryAbstract implements HasBoostOption
14
{
15
	use BoostOption;
16
17
	const NAME = 'dis_max';
18
19
	/**
20
	 * @var QueryCollection
21
	 */
22
	private $queries;
23
24
	protected function get_queries(): QueryCollection
25
	{
26
		return $this->queries;
27
	}
28
29
	public function __construct()
30
	{
31
		$this->queries = new QueryCollection;
0 ignored issues
show
The property queries is declared read-only in olvlvl\ElasticsearchDSL\Query\Compound\DisMaxQuery.
Loading history...
32
		$this->tie_breaker(1.0);
33
	}
34
35
	public function tie_breaker(float $tie_breaker)
36
	{
37
		$this->options[__FUNCTION__] = $tie_breaker;
38
39
		return $this;
40
	}
41
42
	public function jsonSerialize()
43
	{
44
		return [ self::NAME => parent::jsonSerialize() + [
45
46
			'queries' => $this->queries,
47
48
		] ];
49
	}
50
}
51