本文介绍一下解决中同一片文章同时出现的方法
bug描述:
在ss搜索中,当选择“标题”或“内容”搜索时,当结果的文章有分页时,会出现重复的搜索结果
bug解决方法:
修改batch.search.php文件
查找
$query = $_SGLOBAL['db']->query('SELECT COUNT(*) FROM '.tname('spaceitems').' i, '.tname('spacenews').' t WHERE '.$wheresql); $listcount = $_SGLOBAL['db']->result($query, 0); if($listcount) { $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('spaceitems').' i, '.tname('spacenews').' t WHERE '.$wheresql.' LIMIT '.$start.','.$perpage); while ($item = $_SGLOBAL['db']->fetch_array($query)) { $item['url'] = geturl('action/viewnews/itemid/'.$item['itemid']); $iarr[] = $item; } $multipage = multi($listcount, $perpage, $page, S_URL.'/batch.search.php?'.$urlplus); } else { showmessage('not_find_relevant_data'); }
|
替换为
$query = $_SGLOBAL['db']->query('SELECT COUNT(distinct(t.itemid)) FROM '.tname('spaceitems').' i, '.tname('spacenews').' t WHERE '.$wheresql); $listcount = $_SGLOBAL['db']->result($query, 0); if($listcount) { $query = $_SGLOBAL['db']->query('SELECT distinct(t.itemid),type,subject,uid,username,dateline FROM '.tname('spaceitems').' i, '.tname('spacenews').' t WHERE '.$wheresql.' LIMIT '.$start.','.$perpage); while ($item = $_SGLOBAL['db']->fetch_array($query)) { $item['url'] = geturl('action/viewnews/itemid/'.$item['itemid']); $iarr[] = $item; } $multipage = multi($listcount, $perpage, $page, S_URL.'/batch.search.php?'.$urlplus); } else { showmessage('not_find_relevant_data'); }
|
(责任编辑:最模板) |