1

this is my query:

$query = SphinxQL::create($conn)->select('*')
    ->from('my_index')
    ->match('name', 'bird + monkey', true);
    $result = $query->execute();

adding + or || between values works (giving results that match 'bird' and/or 'monkey').

I would like to add more than one operator, something like this:

    $query = SphinxQL::create($conn)->select('*')
    ->from('my_index')
    ->match('name', '(bird + monkey) || cat', true);
    $result = $query->execute();

I tried looking in the Query Builder for SphinxQL and sphinxsearch documentation but couldn't find such an example.

AnatPort
  • 748
  • 8
  • 20
  • Try this .. if this not working let me know ..... $where = "name LIKE '%(bird + monkey)%' OR name LIKE '%cat%'"; $query = SphinxQL::create($conn)->select('*') ->from('my_index') ->match($where); $result = $query->execute(); – Kumar Rakesh Sep 08 '16 at 12:37
  • @KumarRakesh thanks, but it doesn't recognize the word 'LIKE', just gives an empty result. only works like this: `$where = "name '%bird%'";` with no operators. – AnatPort Sep 08 '16 at 12:59
  • Where did `+` and `||` come from? Neither are Sphinx operators! – barryhunter Sep 08 '16 at 18:42
  • 1
    The real operators are here: http://sphinxsearch.com/docs/current.html#extended-syntax – barryhunter Sep 08 '16 at 18:46
  • @barryhunter, thank you, I was actually using the wrong operators. this is what I was looking for. – AnatPort Sep 11 '16 at 07:05

1 Answers1

1

Found the answer thanks to barryhunter. the right syntax is:

 $query = SphinxQL::create($conn)->select('*')
->from('my_index')
->match('name', '("bird  monkey") | cat', true);
$result = $query->execute();
AnatPort
  • 748
  • 8
  • 20