/**
* Search in sphinx client
*
* @param string $query
* @param string $index
* @return SphinxResult|string
* @throws \Exception
*/
public function search($query, $index = '*')
{
$result = $this->_sphinx_client->Query($query, $index);
if (!$result) {
throw new \Exception("Sphinx client error: " . $this->_sphinx_client->GetLastError());
} else {
if (!empty($result['warning'])) {
return $this->_sphinx_client->GetLastWarning();
}
return new SphinxResult($result);
}
}