垂直搜索引擎Sphinx

 $s = new SphinxClient();                    // 实例化APi

 $s->setServer('localhost', 9312);       // 设置服务端,第一个参数sphinx服务器地址,第二个sphinx监听端口
 $s->SetConnectTimeout ( 30 );          //设置链接超时   
 $s->AddQuery();                                //列表查询

 $s->RunQueries ();                            //执行列表查询
 
$s->ResetFilters();                             //清除过滤条件
 $s->BuildExcerpts($docs, $index, $words);//生成简要
 $s->BuildKeywords($query, $index, $hits);//生成关键字
 

 $s->GetLastError();                           //错误
 
$s->GetLastWarning();                      //警告
 $s->FlushAttributes();                        //索引刷入硬盘

 $s->IsConnectError();                        //链接错误
 
$s->ResetGroupBy();                        //重设分组
 $s->SetFieldWeights(array('sub_title'=>1));//加权最小为
 
$s->SetIDRange($min, $max);           //ID范围
 
$s->SetIndexWeights(array('test1'=>1));//索引权重
 
$s->Status();                                      //服务是否可用
 
$s->UpdateAttributes($index, $attrs, $values);//更新硬盘索引
 $s->setMatchMode(SPH_MATCH_ANY);//匹配模式
 
$s->setMaxQueryTime(3);                 //查询超时
 $s->SetSelect ( $select );                 //设置返回的字段
 
$s->SetArrayResult ( true );             //结果是否有ID
 
$s->SetLimits ( 0, 10 );                    //显示数量:开始 量 最大量 右偏移量 
 $s->SetFilter ( 'target_type', $filtervals );//设置过滤,值列表 
 $s->SetFilterFloatRange($attribute, $min, $max);//浮动范围
 $s->SetFilterRange($attribute, $min, $max);//指定范围
 
$s->SetRetries($count);                   //设置失败重试 
 
$result
 = $s->query("good","team"); //查询
 

转载于:https://www.cnblogs.com/liuxl/p/3780809.html

猜你喜欢

转载自blog.csdn.net/weixin_34348174/article/details/93744996