Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/cluster/search/PhabricatorSearchService.php
Show First 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | public static function executeSearch(PhabricatorSavedQuery $query) { | ||||
$exceptions = array(); | $exceptions = array(); | ||||
// try all services until one succeeds | // try all services until one succeeds | ||||
foreach (self::getAllServices() as $service) { | foreach (self::getAllServices() as $service) { | ||||
try { | try { | ||||
$engine = $service->getEngine(); | $engine = $service->getEngine(); | ||||
$res = $engine->executeSearch($query); | $res = $engine->executeSearch($query); | ||||
// return immediately if we get results | // return immediately if we get results | ||||
return $res; | return $res; | ||||
} catch (PhutilSearchQueryCompilerSyntaxException $ex) { | |||||
// If there's a query compilation error, return it directly to the | |||||
// user: they issued a query with bad syntax. | |||||
throw $ex; | |||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$exceptions[] = $ex; | $exceptions[] = $ex; | ||||
} | } | ||||
} | } | ||||
$msg = pht('All of the configured Fulltext Search services failed.'); | $msg = pht('All of the configured Fulltext Search services failed.'); | ||||
throw new PhutilAggregateException($msg, $exceptions); | throw new PhutilAggregateException($msg, $exceptions); | ||||
} | } | ||||
} | } |