//拆分关键字 提取的时候 注意使用 trim($result[i] ) 把前后空格去掉
function text_explode($strTemp)
{
$oldArray=array( " "," "," "," "," ","," );
$newArray=array("|","|","|","|","|","|");
$newphrase=str_replace($oldArray,$newArray,$strTemp);
$newphrase=str_replace("|||","|", $newphrase);
$newphrase=str_replace("||","|", $newphrase);
// echo $newphrase;
$result=explode("|",$newphrase);

// echo "<br />";
// print_r($result);
return $result;
}
// 应用在 select * from tbl_user where id in('1','2','3')
//同理 也可用于 多个删除 delete from tbl_user where id in('1','2','3')
function implodeids($array)
{
if(!empty($array)) {
return "'".implode("','", is_array($array) ? $array : array($array))."'";
} else {
return '';
}
}
建立 searchIndex 中间表 用于存储 搜索关键字。中对应的 要搜索 物品的id,
在搜索的时候先 查询该关键字 是否在 tbl_searchindex表中存在 如果有 就直接通过searchid来去 物品Id,
再生产物品列表.、
如果没有就 先搜索物品列表 把物品列表 和关键字 放入searchindex 起到了搜索缓存效果。
在搜索中 使用( or ) and ( or )
每个or 语句尽量要考虑是否可以用union 语句
还要把 基本上用的 标签 搜索添加到热门搜索 列表中去