private function getSuggest()
    {
        if ($suggestions = Utils::findKey($this->options, 'suggest', false))
        {
            $suggest_fields = Utils::findKey($this->proxy->getConfig(), 'suggest', []);

            if ($fields = Utils::findKey($this->options, 'fields', false))
            {
                $suggest_fields = array_intersect($suggest_fields, $fields);
            }

            if (!empty($suggest_fields))
            {
                $this->payload['suggest'] = ['text' => $this->term];
                foreach ($suggest_fields as $field)
                {
                    $this->payload['suggest'][$field] = ['phrase' => ['field' => "${field}.suggest"]];
                }
            }
        }
    }
private function getSuggest()
    {
        if ($suggestions = Utils::findKey($this->options, 'suggest', false))
        {
            $suggest_fields = Utils::findKey($this->proxy->getConfig(), 'suggest', []);

            if ($fields = Utils::findKey($this->options, 'fields', false))
            {
                $suggest_fields = array_intersect($suggest_fields, $fields);
            }

            if (!empty($suggest_fields))
            {
                $this->payload['suggest'] = ['text' => $this->term];
                foreach ($suggest_fields as $field)
                {
                    $this->payload['suggest'][$field] = ['phrase' => ['field' => "${field}.suggest"]];
                }
            }
        }
    }
private function getSuggest ( ) { if ( $ suggestions = Utils :: findKey ( $ this -> options , 'suggest' , false ) ) { $ suggest_fields = Utils :: findKey ( $ this -> proxy -> getConfig ( ) , 'suggest' , [ ] ) ; if ( $ fields = Utils :: findKey ( $ this -> options , 'fields' , false ) ) { $ suggest_fields = array_intersect ( $ suggest_fields , $ fields ) ; } if ( ! empty ( $ suggest_fields ) ) { $ this -> payload [ 'suggest' ] = [ 'text' => $ this -> term ] ; foreach ( $ suggest_fields as $ field ) { $ this -> payload [ 'suggest' ] [ $ field ] = [ 'phrase' => [ 'field' => "${field}.suggest" ] ] ; } } } }
Add requested suggestions to the payload
Add requested suggestions to the payload