首页 > 文章 > 杂文

phpcms v9搜索结果缺少及搜索信息不准确
时间:2021-08-13 17:57:08  点击: 来源:  作者:

打开 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)"; ...

打开 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

”您可通过以下微信二维码,赞赏作者“
 
 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
推荐资讯
windows如何挂载webdav?
windows如何挂载webda
linux服务器同步互联网时间
linux服务器同步互联
亚马逊云lightsail服务器使用教程 | 亚马逊云lightsail使用指南
亚马逊云lightsail服
hostdare 4折优惠,直接降价60% 美国洛杉矶低至 $10.4/年 768M内存/1核/10gNVMe/500g流量
hostdare 4折优惠,直接
相关文章
栏目更新
栏目热门

关于我们 | 广告服务 | 联系我们 | 网站地图 | 免责声明 | WAP | RSS


Copyright © 运维之家 2013-2024