coreseek里not in 和 关键词为空怎么处理?

jaksmine 2013-04-17 04:15:37
linux下coreseek服务已经搭建好,

使用php接口调用
require WEIBO_ROOT . 'source/class/class_sphinx.php' ;
$cl = new SphinxClient ();
$sphinx = getglobal('config/sphinx' );
$cl->SetServer ( $sphinx ['host' ], $sphinx ['port' ]);
$cl->setMatchMode(SPH_MATCH_ANY);
$cl->setLimits(0, 5);
$cl->SetFilter ( "tid", array (68, 69));
$cl->SetFilter ( "status", array (0));
$cl->SetFilter ( "top_status", array (2));
$cl->setFilterRange('pubtime', 0, $_G['timestamp']);
$cl->SetSortMode ( SPH_SORT_ATTR_DESC, "top_status" );
$cl->SetSortMode ( SPH_SORT_ATTR_ASC, "totalnum" );
$res = $cl ->Query ( '我', "library" );
if (isset ($res ['matches' ])) {
$cid_arr = array_keys($res ['matches' ]);
$cids = implode(',' , $cid_arr );
}
echo '<pre>';
//print_r($cl);

print_r($res);exit;

我要加个cid not in (5,6)这样的条件该怎么加,

还有关键词为空时怎么出结果?
...全文
215 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
caochengli 2013-04-18
  • 打赏
  • 举报
回复
cid not in (5,6)写成: $cl->SetFilter ( "tid", array (5,6), true); 默认关键次为空是是没有结果的,如果要展现所有信息,需要修改匹配模式为SPH_MATCH_FULLSCAN $cl->setMatchMode(SPH_MATCH_FULLSCAN);

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧