本文整理汇总了PHP中Elastica\Script::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Script::create方法的具体用法?PHP Script::create怎么用?PHP Script::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elastica\Script
的用法示例。
在下文中一共展示了Script::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setScript
/**
* 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;
}
示例2: setScript
/**
* 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());
}
示例3: testCreateInvalid
/**
* @group unit
* @dataProvider dataProviderCreateInvalid
* @expectedException \Elastica\Exception\InvalidException
*/
public function testCreateInvalid($data)
{
Script::create($data);
}
示例4: setScript
/**
* @param \Elastica\Script|array|string $data
* @return \Elastica\Document
*/
public function setScript($data)
{
$script = Script::create($data);
$this->_script = $script;
return $this;
}
示例5: setScript
/**
* Sets script object.
*
* @param \Elastica\Script|string|array $script
*
* @return $this
*/
public function setScript($script)
{
return $this->setParam('script', Elastica\Script::create($script));
}
示例6: addFilterScript
/**
* 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);
}
示例7: setScript
/**
* 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;
}