1<?php 2 3namespace Elastica\Query; 4 5/** 6 * Constant score query. 7 * 8 * @author Nicolas Ruflin <spam@ruflin.com> 9 * 10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html 11 */ 12class ConstantScore extends AbstractQuery 13{ 14 /** 15 * Construct constant score query. 16 */ 17 public function __construct(?AbstractQuery $filter = null) 18 { 19 if (null !== $filter) { 20 $this->setFilter($filter); 21 } 22 } 23 24 /** 25 * Set filter. 26 * 27 * @return $this 28 */ 29 public function setFilter(AbstractQuery $filter): self 30 { 31 return $this->setParam('filter', $filter); 32 } 33 34 /** 35 * Set boost. 36 * 37 * @return $this 38 */ 39 public function setBoost(float $boost): self 40 { 41 return $this->setParam('boost', $boost); 42 } 43} 44