和 sphinx 中过滤器的多个值 [英] AND multiple values of a filter in sphinx

查看:57
本文介绍了和 sphinx 中过滤器的多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 sphinx 索引 tag_id 中有一个属性,现在我想获取所有具有 tag_id 10 和 11 的记录

I have an attribute in my sphinx index tag_id and now I want to fetch all record that have tag_id 10 and 11

当我执行 $sphinxClient->setFilter('tag_id', array(10,11)) 时,它获取的所有 tag_id 都是 10 或 11是否可以对两个值进行 AND 而不是 OR?

When I do $sphinxClient->setFilter('tag_id', array(10,11)) it fetches all have tag_id 10 or 11 Is it possible to AND both values rather than OR?

推荐答案

$sphinxClient->setFilter('tag_id', array(10));
$sphinxClient->setFilter('tag_id', array(11));

对 setFilter 的多次调用是 AND 运算的 :)

Multiple calls to setFilter are ANDed :)

这篇关于和 sphinx 中过滤器的多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆