...
|
...
|
@@ -21,13 +21,21 @@ class SearchController extends WebAction |
|
|
*/
|
|
|
public function suggestAction()
|
|
|
{
|
|
|
$suggest = '';
|
|
|
$callback = $this->get('callback');
|
|
|
$query = rawurldecode($this->get('query'));
|
|
|
$size = rawurldecode($this->get('size',10));
|
|
|
if (empty($query)) {
|
|
|
$this->helpJsonCallbackResult($callback, 412, '搜索词为空');
|
|
|
}
|
|
|
if ($size > 50) {
|
|
|
$size = 10;
|
|
|
}
|
|
|
if ($query) {
|
|
|
$param['query'] = $query;
|
|
|
$param['size'] = $size;
|
|
|
$suggest = SearchModel::getSuggest($param);
|
|
|
}
|
|
|
echo $suggest;
|
|
|
$this->helpJsonCallbackResult($callback, 200, 'suggest', $suggest);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|