phpsphinxsphinxql

SphinxQL query builder - how to add multiple and/or operators to match


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.


Solution

  • 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();