本篇文章主要介绍一个php和coreseek结合的例子,有对php如何连接coreseek感兴趣的小伙伴参考下。
以下是代码
SetServer ( $host, $port );
$cl->SetConnectTimeout ( 1 );
$cl->SetWeights ( array ( 100, 1 ) );
$cl->SetMatchMode ( $mode );
$cl->SetLimits ( $off, $limit, ( $limit>10000 ) ? $limit : 10000 );
$cl->SetRankingMode ( $ranker );
$cl->SetArrayResult ( true );
$res = $cl->Query ( join(" ", $keywords), $index );
if($res) {
$pageL = PageQuery($res['total'],$page,4,"act=search&keywords=".$_REQUEST['keywords']);
foreach($res['matches'] as $v) {
$arrID[] = $v['id'];
}
$rs = $GLOBALS['db']->GetAll("select id,title,content from info where id in(".join(',', $arrID).")");
$GLOBALS['tpl']->assign('pageL', $pageL);
//echo '';
//print_r($res);
//echo '';
return $rs;
}
}
?>相关推荐:
linux下编译安装Sphinx、中文分词coreseek及PHP的sphinx扩展
露阳PHP企业系统1.0
1.) 将所有文件解压到php环境中,本程序才用smarty+php+mysql设计。如果运行不了,请修改hhy文件夹下的smarty.php文件改法请看说明2.) 修改configs下的config.inc.php下的连接数据库的密码和用户名3.) 本程序没有做安全页面,人工导入sql.inc到mysql数据库。管理员初始化帐号为admin,密码为hhy。后台地址:http://你的网站地址/h
下载
立即学习“PHP免费学习笔记(深入)”;










