如何用OR条件编写sphinx查询

yoh*_*bin 2 sphinx

我需要在OR项目的项目中创建一个sphinx查询.但是给出一个OR条件

select cost FROM transactionsChart WHERE cost=25 OR cost=5;
Run Code Online (Sandbox Code Playgroud)

不管用.它返回一个错误

ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR cost=5'
Run Code Online (Sandbox Code Playgroud)

有谁能够帮我....

提前致谢

bar*_*ter 8

Sphinx OR在WHERE子句中不支持. AND

对于您的具体示例,可以使用IN语法,

sphinxql> SELECT cost FROM transactionsChart WHERE cost IN (5,25);
Run Code Online (Sandbox Code Playgroud)

或者更通用的解决方案是使用虚拟属性

sphinxql> SELECT cost, IF(cost=25 OR cost=5,1,0) AS filter 
      FROM transactionsChart WHERE filter = 1;
Run Code Online (Sandbox Code Playgroud)