搜索框的结果
搜索页面 全部结果项
搜索页面 文章项
改过的代码:
Models/System.php 里加了自定义换字体大小写的函数
public function _strtolower($string)
{
$small = array('а','б','в','г','д','е','ё','ж','з','и','й',
'к','л','м','н','о','п','р','с','т','у','ф',
'х','ч','ц','ш','щ','ю','я','ы','ъ','ь',
'э','ә','і','ң','ғ','ү','ұ','қ','ө','һ',
'a','b','c','d','e','f','g','h','i',
'j','k','l','m','n','o','p','q','r',
's','t','u','v','w','x','y','z');
$large = array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й',
'К','Л','М','Н','О','П','Р','С','Т','У','Ф',
'Х','Ч','Ц','Ш','Щ','Ю','Я','Ы','Ъ','Ь',
'Э','Ә','І','Ң','Ғ','Ү','Ұ','Қ','Ө','Һ',
'A','B','C','D','E','F','G','H','I',
'J','K','L','M','N','O','P','Q','R',
'S','T','U','V','W','X','Y','Z');
return str_replace($large, $small, $string);
}
Models/System.php 修改了运用中文分词的代码
public function analysis_keyword($string)
{
$keywords = preg_split("/[\s,]+/",$this->_strtolower($string));
if ($result =$keywords )
{
$result = array_unique($result);
foreach ($result as $key => $keyword)
{
if (!$this->check_stop_keyword($keyword))
{
unset($result[$key]);
}
else
{
$result[$key] = trim($keyword);
}
}
}
return $result;
}