sphinx 字段区间查询

这里根据updatetime字段查六个月内满足条件的数据
$sixMothAgotime=strtotime( date('Y-m-d H:i:s')." - "180 day");

$sphinx->setFilterRange('updatetime',$sixMothAgotime,time());

$at_resource =$sphinx->Query($keyword,'at_resource');
halt($at_resource);
注意如果要进行查询要在配置文件里设置数据源sql_attr_*的设置,有uint、bool、bigint、timestamp、float、string等数据类型

如这里在数据源要加上

sql_attr_timestamp    = updatetime

然后在索引里配置

docinfo			= extern

猜你喜欢

转载自blog.csdn.net/weixin_41858542/article/details/86299517