本文整理汇总了PHP中Elasticsearch\Client::suggest方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::suggest方法的具体用法?PHP Client::suggest怎么用?PHP Client::suggest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elasticsearch\Client
的用法示例。
在下文中一共展示了Client::suggest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: suggest
/**
* Run a suggestion request.
*
* @param \Elodex\Suggest $suggest
* @param string|null $index
* @return \Elodex\SuggestResult
*/
public function suggest(Suggest $suggest, $index = null)
{
$indexName = $index ?: $this->getDefaultIndex();
$params = ['index' => $indexName];
$params['body'] = $suggest->toArray();
// Perform the suggest request.
$results = $this->client->suggest($params);
return new SuggestResult($results);
}
示例2: suggest
public function suggest($params = [])
{
if (!isset($params['index'])) {
$params['index'] = $this->getSearchIndex();
}
$this->requestToScreen($params, 'SUGGEST');
try {
return parent::suggest($params);
} catch (\Exception $e) {
$this->registerErrorForException($e);
return array();
}
}
示例3: suggestStatement
/**
* Execute a map statement on index;.
*
* @param array $suggestions
*
* @return array
*/
public function suggestStatement(array $suggestions)
{
return $this->elastic->suggest($this->setStatementIndex($suggestions));
}