mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-17 07:45:29 +08:00
限制全文搜索长度为50
This commit is contained in:
parent
f5665bc94a
commit
77b7224901
@ -28,7 +28,7 @@ class Article extends Handler
|
||||
$paginator = new XunSearchPaginator([
|
||||
'xs' => $searcher->getXS(),
|
||||
'highlight' => $searcher->getHighlightFields(),
|
||||
'query' => $params['query'],
|
||||
'query' => $this->handleKeywords($params['query']),
|
||||
'page' => $page,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
@ -28,7 +28,7 @@ class Course extends Handler
|
||||
$paginator = new XunSearchPaginator([
|
||||
'xs' => $searcher->getXS(),
|
||||
'highlight' => $searcher->getHighlightFields(),
|
||||
'query' => $params['query'],
|
||||
'query' => $this->handleKeywords($params['query']),
|
||||
'page' => $page,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
@ -18,4 +18,9 @@ abstract class Handler extends LogicService
|
||||
|
||||
abstract function getRelatedQuery($query, $limit);
|
||||
|
||||
}
|
||||
protected function handleKeywords($str)
|
||||
{
|
||||
return kg_substr($str, 0, 50, '');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class Question extends Handler
|
||||
$paginator = new XunSearchPaginator([
|
||||
'xs' => $searcher->getXS(),
|
||||
'highlight' => $searcher->getHighlightFields(),
|
||||
'query' => $params['query'],
|
||||
'query' => $this->handleKeywords($params['query']),
|
||||
'page' => $page,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user