Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用或条件编写sphinx查询_Sphinx - Fatal编程技术网

如何使用或条件编写sphinx查询

如何使用或条件编写sphinx查询,sphinx,Sphinx,我需要在项目中使用或条件创建sphinx查询。但是给出一个或类似的条件 select cost FROM transactionsChart WHERE cost=25 OR cost=5; 它不起作用。它返回一个错误,如 ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR cost=5' 谁能帮我 提前感谢尝试 select cost FROM transactionsChar

我需要在项目中使用或条件创建sphinx查询。但是给出一个或类似的条件

select cost FROM transactionsChart WHERE cost=25 OR cost=5;
它不起作用。它返回一个错误,如

ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR cost=5'
谁能帮我

提前感谢

尝试

select cost FROM transactionsChart WHERE cost=25 | cost=5;

斯芬克斯不支持WHERE子句中的
,只支持

对于您的特定示例,可以在
语法中使用

sphinxql> SELECT cost FROM transactionsChart WHERE cost IN (5,25);
或者更一般的解决方案是使用虚拟属性

sphinxql> SELECT cost, IF(cost=25 OR cost=5,1,0) AS filter 
      FROM transactionsChart WHERE filter = 1;
不,那不行。您链接到的文档用于扩展语法,这是
MATCH(…)
子句中理解的全文语法,它不适用于WHERE子句的其余部分。