From 1e5558d38370d2b349653a8de5bd08f5ac57fcf6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 15 Aug 2022 11:06:18 +0800 Subject: [PATCH] * adjust for search. --- module/search/model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/search/model.php b/module/search/model.php index 4055974eb6..0c17675817 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -612,7 +612,7 @@ class searchModel extends model $likeCondition = ''; /* Assisted lookup by like condition when only one word. */ - if(count($words) == 1 and strpos($words[0], ' ') === false and !is_numeric($words[0])) $likeCondition = "OR title like '%{$words[0]}%' OR content like '%{$words[0]}%'"; + if(count($words) == 1 and strpos($words[0], ' ') === false and !is_numeric($words[0])) $likeCondition = "OR title like '%{$trimedWord}%' OR content like '%{$trimedWord}%'"; $words = str_replace('"', '', $against); $words = str_pad($words, 5, '_'); @@ -653,8 +653,7 @@ class searchModel extends model $typeCount = $this->dao->select("objectType, count(*) as objectCount") ->from(TABLE_SEARCHINDEX) - ->where("(MATCH(title,content) AGAINST('{$againstCond}' IN BOOLEAN MODE) >= 1 {$likeCondition})") - ->andWhere('vision')->eq($this->config->vision) + ->where('vision')->eq($this->config->vision) ->andWhere('objectType')->in($allowedObject) ->andWhere('addedDate')->le(helper::now()) ->groupBy('objectType')