phpcms v9搜索结果缺少及搜索信息不准确
2021-08-13 17:57:08   来源:   评论:0 点击: 收藏

打开 phpcms modules search index php找到:if(!empty($segment_q)) { $sql = "`siteid`= $siteid AND `typeid` = $typeid $sql
打开 phpcms\modules\search\index.php
找到:

if(!empty($segment_q)) {
        $sql = "`siteid`= $siteid AND `typeid` = $typeid $sql_time AND MATCH (`data`) AGAINST ($segment_q IN BOOLEAN MODE)";
}else {
        $sql = "`siteid`= $siteid AND `typeid` = $typeid $sql_time AND `data` like %$q%";
}


替换为:

if(!empty($segment_q)) {
        $length = strlen($segment_q);
        $q_key = "'".$segment_q."'";
        if($length>=9){
                $sql = "`siteid`= '1' AND `typeid` = '$typeid' AND (SELECT (LENGTH(`data`)-LENGTH(REPLACE(`data`,$q_key,'')))) >17";              
        }else{
                $sql = "`siteid`= '1' AND `typeid` = '$typeid' AND (SELECT (LENGTH(`data`)-LENGTH(REPLACE(`data`,$q_key,'')))) >11";              
        }                              
} else {
        $sql = "`siteid`= '$siteid' AND `typeid` = '$typeid' AND `data` like '%$q%'";                                      
}


phpcms v9各版本下载可前往本站下载点 :

https://mirror.cnop.net/?search=phpcms



相关热词搜索:

上一篇:常用国内外服务器主机商盘点
下一篇:linux安装swoole4