Наследование: extends Elastica\Param
 /**
  * Add a suggestion to this suggest clause
  * @param AbstractSuggest $suggestion
  * @return \Elastica\Suggest
  */
 public function addSuggestion(AbstractSuggest $suggestion)
 {
     return $this->setParam($suggestion->getName(), $suggestion->toArray());
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function toArray()
 {
     $array = parent::toArray();
     $baseName = $this->_getBaseName();
     if (isset($array[$baseName]['candidate_generator'])) {
         $generator = $array[$baseName]['candidate_generator'];
         unset($array[$baseName]['candidate_generator']);
         $keys = array_keys($generator);
         $values = array_values($generator);
         $array[$baseName][$keys[0]][] = $values[0];
     }
     return $array;
 }