コード例 #1
0
 /**
  * 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
0
ファイル: Script.php プロジェクト: raadhuis/modx-basic
 /**
  * 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
0
 /**
  * @group unit
  * @dataProvider dataProviderCreateInvalid
  * @expectedException \Elastica\Exception\InvalidException
  */
 public function testCreateInvalid($data)
 {
     Script::create($data);
 }
コード例 #4
0
 /**
  * @param \Elastica\Script|array|string $data
  * @return \Elastica\Document
  */
 public function setScript($data)
 {
     $script = Script::create($data);
     $this->_script = $script;
     return $this;
 }
コード例 #5
0
ファイル: Script.php プロジェクト: zhangxiaoliu/Elastica
 /**
  * Sets script object.
  *
  * @param \Elastica\Script|string|array $script
  *
  * @return $this
  */
 public function setScript($script)
 {
     return $this->setParam('script', Elastica\Script::create($script));
 }
コード例 #6
0
 /**
  * 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
0
ファイル: Terms.php プロジェクト: nadeem-khan/Elastica
 /**
  * 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;
 }