垂直搜索引擎Sphinx

垂直搜索引擎Sphinx

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

$s->setServer(‘localhost’, 9312); // 设置服务端,第一个参数sphinx服务器地址,第二个sphinx监听端口
$s->SetConnectTimeout ( 30 ); //设置链接超时
$s->AddQuery(); //列表查询
$s->RunQueries (); //执行列表查询
$s->ResetFilters(); //清除过滤条件
s − > B u i l d E x c e r p t s ( s->BuildExcerpts( s>BuildExcerpts(docs, $index, $words);//生成简要
s − > B u i l d K e y w o r d s ( s->BuildKeywords( s>BuildKeywords(query, $index, $hits);//生成关键字
$s->GetLastError(); //错误
$s->GetLastWarning(); //警告
$s->FlushAttributes(); //索引刷入硬盘
$s->IsConnectError(); //链接错误
$s->ResetGroupBy(); //重设分组
$s->SetFieldWeights(array(‘sub_title’=>1));//加权最小为
s − > S e t I D R a n g e ( s->SetIDRange( s>SetIDRange(min, $max); //ID范围
$s->SetIndexWeights(array(‘test1’=>1));//索引权重
$s->Status(); //服务是否可用
s − > U p d a t e A t t r i b u t e s ( s->UpdateAttributes( 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 − > S e t F i l t e r F l o a t R a n g e ( s->SetFilterFloatRange( s>SetFilterFloatRange(attribute, $min, $max);//浮动范围
s − > S e t F i l t e r R a n g e ( s->SetFilterRange( s>SetFilterRange(attribute, $min, $max);//指定范围
s − > S e t R e t r i e s ( s->SetRetries( s>SetRetries(count); //设置失败重试
$result = $s->query(“good”,“team”); //查询

希望可以帮助到您~

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值