Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/engine/PhabricatorSearchEngineElastic.php
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | public function executeSearch(PhabricatorSavedQuery $query) { | ||||
} catch (HTTPFutureResponseStatusHTTP $ex) { | } catch (HTTPFutureResponseStatusHTTP $ex) { | ||||
// elasticsearch probably uses Lucene query syntax: | // elasticsearch probably uses Lucene query syntax: | ||||
// http://lucene.apache.org/core/3_6_1/queryparsersyntax.html | // http://lucene.apache.org/core/3_6_1/queryparsersyntax.html | ||||
// Try literal search if operator search fails. | // Try literal search if operator search fails. | ||||
if (!strlen($query->getParameter('query'))) { | if (!strlen($query->getParameter('query'))) { | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
$query = clone $query; | $query = clone $query; | ||||
$query->setQuery( | $query->setParameter( | ||||
'query', | |||||
addcslashes( | addcslashes( | ||||
$query->getParameter('query'), '+-&|!(){}[]^"~*?:\\')); | $query->getParameter('query'), '+-&|!(){}[]^"~*?:\\')); | ||||
$response = $this->executeRequest($uri, $this->buildSpec($query)); | $response = $this->executeRequest($uri, $this->buildSpec($query)); | ||||
} | } | ||||
$phids = ipull($response['hits']['hits'], '_id'); | $phids = ipull($response['hits']['hits'], '_id'); | ||||
return $phids; | return $phids; | ||||
} | } | ||||
Show All 29 Lines |