/** * Set script * * @param string|\Elastica\Script $script * @return \Elastica\Query\CustomScore */ public function setScript($script) { $script = Script::create($script); foreach ($script->toArray() as $param => $value) { $this->setParam($param, $value); } return $this; }
/** * Sets script object * * @param \Elastica\Script|string|array $script * @return \Elastica\Filter\Script */ public function setScript($script) { $script = Elastica\Script::create($script); return $this->setParams($script->toArray()); }
/** * @group unit * @dataProvider dataProviderCreateInvalid * @expectedException \Elastica\Exception\InvalidException */ public function testCreateInvalid($data) { Script::create($data); }
/** * @param \Elastica\Script|array|string $data * @return \Elastica\Document */ public function setScript($data) { $script = Script::create($data); $this->_script = $script; return $this; }
/** * Sets script object. * * @param \Elastica\Script|string|array $script * * @return $this */ public function setScript($script) { return $this->setParam('script', Elastica\Script::create($script)); }
/** * Add a filter with a script to calculate the score * Only script part of script object is used * * @param \Elastica\Filter\AbstractFilter $filter Filter object * @param \Elastica\Script|string|array $script Script for calculating the score * @return \Elastica\Query\CustomFiltersScore Current object */ public function addFilterScript(AbstractFilter $filter, $script) { $script = Script::create($script); $filterParam = array('filter' => $filter->toArray(), 'script' => $script->getScript()); return $this->addParam('filters', $filterParam); }
/** * Sets the script for the term. * * @param string $script The script for the term. * * @return $this */ public function setScript($script) { $this->setParam('script', Script::create($script)); return $this; }