throw exception on sphinx search error

This commit is contained in:
Evan Prodromou 2011-12-30 23:09:17 -08:00
parent c9fbe2ead7
commit 9092eb5535

View File

@ -65,6 +65,9 @@ class SphinxSearch extends SearchEngine
function query($q) function query($q)
{ {
$result = $this->sphinx->query($q, $this->remote_table()); $result = $this->sphinx->query($q, $this->remote_table());
if ($result === false) {
throw new ServerException($this->sphinx->getLastError());
}
if (!isset($result['matches'])) return false; if (!isset($result['matches'])) return false;
$id_set = join(', ', array_keys($result['matches'])); $id_set = join(', ', array_keys($result['matches']));
$this->target->whereAdd("id in ($id_set)"); $this->target->whereAdd("id in ($id_set)");