mysql搜索问题
按照昨天一个帖子里面的方法改了一下只搜索别名 名称 演员,但是查看到mysql慢日记里面还有查询好几项内容的搜索,不知道是哪里的,,特来问下...select m.*,0,0 from sea_data mwhere m.v_recycled=0 and (m.v_name like '%聊斋%' or m.v_actor like '%聊斋%' or m.v_director like '%聊斋%' or m.v_publisharea like '%聊斋%' or m.v_nickname like '%聊斋%'or m.v_publishyear like '%聊斋%' or m.v_letter='聊斋' or m.v_tags='聊斋')order by m.v_addtime desc limit 50,10;
search.php修改的如下,因为我是9.99版本,没法直接升级10.2
switch (intval($searchtype)) {
case -1:
$whereStr=" where v_recycled=0 and (v_name like '%$searchword%' or v_actor like '%$searchword%' or v_nickname like '%$searchword%')";
break;
case 0:
$whereStr=" where v_recycled=0 and v_name like '%$searchword%'";
break;
case 1:
$whereStr=" where v_recycled=0";
if(!empty($tid)) $whereStr.=" and (tid in (".getTypeId($tid).") or FIND_IN_SET('".$tid."',v_extratype)<>0)";
if($year=="more")
{
$publishyeartxt=sea_DATA."/admin/publishyear.txt";
$publishyear = array();
if(filesize($publishyeartxt)>0)
{
$publishyear = file($publishyeartxt);
}
$yearArray=$publishyear;
$yeartxt= implode(',',$yearArray);
$whereStr.=" and v_publishyear not in ($yeartxt)";
}
if(!empty($year) AND $year!="more")
{$whereStr.=" and v_publishyear='$year'";}
if($letter=="0-9")
{$whereStr.=" and v_letter in ('0','1','2','3','4','5','6','7','8','9')";}
if(!empty($letter) AND $letter!="0-9")
{$whereStr.=" and v_letter='$letter'";}
if(!empty($area)) $whereStr.=" and v_publisharea='$area'";
if(!empty($yuyan)) $whereStr.=" and v_lang='$yuyan'";
if(!empty($jq)) $whereStr.=" and v_jq like'%$jq%'";
if($state=='l') $whereStr.=" and v_state !=0";
if($state=='w') $whereStr.=" and v_state=0";
if($money=='s') $whereStr.=" and v_money !=0";
if($money=='m') $whereStr.=" and v_money=0";
if(!empty($ver)) $whereStr.=" and v_ver='$ver'";
break;
}
解决方法:
需要同时修改search.php和include/main.class.php这两个文件
页:
[1]