This function can be used to handle params for queries, filter
Author: Nicolas Ruflin (spam@ruflin.com)
Inheritance: implements elastica\ArrayableInterface
 /**
  * @group unit
  */
 public function testHasParam()
 {
     $param = new Param();
     $key = 'name';
     $value = 'nicolas ruflin';
     $this->assertFalse($param->hasParam($key));
     $param->setParam($key, $value);
     $this->assertTrue($param->hasParam($key));
 }
 /**
  * @return array
  */
 public function toArray()
 {
     $array = parent::toArray();
     if (isset($this->_text)) {
         $array['text'] = $this->_text;
     }
     return $array;
 }
示例#3
0
 /**
  * @return array
  */
 public function toArray()
 {
     $array = parent::toArray();
     if (array_key_exists('global_aggregation', $array)) {
         // compensate for class name GlobalAggregation
         $array = array('global' => new \stdClass());
     }
     if (sizeof($this->_aggs)) {
         $array['aggs'] = $this->_convertArrayable($this->_aggs);
     }
     return $array;
 }
 /**
  * {@inheritdoc}
  */
 public function toArray()
 {
     $array = parent::toArray();
     $baseName = $this->_getBaseName();
     if (isset($array[$baseName]['suggestion'])) {
         $suggestion = $array[$baseName]['suggestion'];
         unset($array[$baseName]['suggestion']);
         foreach ($suggestion as $key => $value) {
             $array[$baseName][$key] = $value;
         }
     }
     return $array;
 }