/*
*coreseek搜索话题
*/
public function actionSearchforum(){
$request=yii::$app->request;
if ($request->isAjax) {
$search=$request->post("search");
//echo $search;die;
require ( "SphinxClient.php" );
$cl = new SphinxClient();
$cl->SetServer ( '127.0.0.1', 9312);
$cl->SetConnectTimeout ( 3 );
$cl->SetArrayResult ( true );
$cl->SetMatchMode ( SPH_MATCH_ANY);
$res = $cl->Query ( "$search", "*" );
//echo json_encode($res);die;
$matches=$res['matches'];
if (!$matches) {
echo 0;die;
}
foreach ($matches as $k => $val) {
$forum=Classforum::findOne($val['id']);
$matches[$k]['title']=$forum['title'];
$matches[$k]['content']=$forum['content'];
}
echo json_encode($matches);
}else{
return $this->render("searchforum");
}
}
*coreseek搜索话题
*/
public function actionSearchforum(){
$request=yii::$app->request;
if ($request->isAjax) {
$search=$request->post("search");
//echo $search;die;
require ( "SphinxClient.php" );
$cl = new SphinxClient();
$cl->SetServer ( '127.0.0.1', 9312);
$cl->SetConnectTimeout ( 3 );
$cl->SetArrayResult ( true );
$cl->SetMatchMode ( SPH_MATCH_ANY);
$res = $cl->Query ( "$search", "*" );
//echo json_encode($res);die;
$matches=$res['matches'];
if (!$matches) {
echo 0;die;
}
foreach ($matches as $k => $val) {
$forum=Classforum::findOne($val['id']);
$matches[$k]['title']=$forum['title'];
$matches[$k]['content']=$forum['content'];
}
echo json_encode($matches);
}else{
return $this->render("searchforum");
}
}