如何在Sphinxql查询生成器中添加匹配模式
问题描述:
here is my query Sphinxql query
$query =SphinxQL::query()->select('*')
->from('table1')->match('title','hel',)->execute();
//title is column name
I need a records having the text hel
anywhere for eg mysql Like %string%
In above its retrieving the records which are matching the hel
words
I need to add setmatchmode(SPH_MATCH_ANY)
where I need to add this is Sphinxql
query
这里是我的查询Sphinxql查询 p>
$ query = SphinxQL :: query() - > select('*')
- > from('table1') - > match('title','hel',) - > execute();
// title是列名
code> pre>
我需要一个记录 hel code>的文本,例如mysql Like%string% p>
在上面检索与 hel code>字匹配的记录 p>
我需要添加 setmatchmode(SPH_MATCH_ANY) code>我需要添加的是 Sphinxql code>查询 p>
div>
答
Frankly you are better NOT using matching modes, even thou it is technically possible via SphinxQL.
Instead just rewrite the query using quorum syntax....
->match('title',expr('"hel two there"/1'))
Edited to clarify may need to use an expression to avoid automatic escaping provided by the framework. (thanks to the comments!)