How to add Matching Modes in Sphinxql query builder

1.3k Views Asked by At

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

1

There are 1 best solutions below

1
barryhunter On

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!)