From 6600b76ad9bfdbcb2ee1b58931bed89c8f58593b Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 11 Aug 2022 07:01:08 +0000 Subject: [PATCH] * Fix bug #26307 --- module/search/control.php | 15 ++++----------- module/search/model.php | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/module/search/control.php b/module/search/control.php index d8d664c414..6971bb6295 100644 --- a/module/search/control.php +++ b/module/search/control.php @@ -231,18 +231,11 @@ class search extends control $pager = new pager(0, $this->config->search->recPerPage, $pageID); $results = $this->search->getList($words, $type, $pager); - if($words) + $typeCount = $this->search->getListCount(''); + $typeList = array('all' => $this->lang->search->modules['all']); + foreach($typeCount as $objectType => $count) { - $typeCount = $this->search->getListCount($words); - $typeList = array('all' => $this->lang->search->modules['all']); - foreach($typeCount as $objectType => $count) - { - $typeList[$objectType] = $this->lang->search->modules[$objectType]; - } - } - else - { - $typeList = $this->lang->search->modules; + $typeList[$objectType] = $this->lang->search->modules[$objectType]; } /* Set session. */ diff --git a/module/search/model.php b/module/search/model.php index 444e864a76..8132a948b3 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) $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 '%{$words[0]}%' OR content like '%{$words[0]}%'"; $words = str_replace('"', '', $against); $words = str_pad($words, 5, '_');