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