3 final class PhabricatorElasticsearchHost
4 extends PhabricatorSearchHost
{
7 private $path = 'phabricator/';
8 private $protocol = 'http';
10 const KEY_REFS
= 'search.elastic.refs';
13 public function setConfig($config) {
14 $this->setRoles(idx($config, 'roles', $this->getRoles()))
15 ->setHost(idx($config, 'host', $this->host
))
16 ->setPort(idx($config, 'port', $this->port
))
17 ->setProtocol(idx($config, 'protocol', $this->protocol
))
18 ->setPath(idx($config, 'path', $this->path
))
19 ->setVersion(idx($config, 'version', $this->version
));
23 public function getDisplayName() {
24 return pht('Elasticsearch');
27 public function getStatusViewColumns() {
29 pht('Protocol') => $this->getProtocol(),
30 pht('Host') => $this->getHost(),
31 pht('Port') => $this->getPort(),
32 pht('Index Path') => $this->getPath(),
33 pht('Elastic Version') => $this->getVersion(),
34 pht('Roles') => implode(', ', array_keys($this->getRoles())),
38 public function setProtocol($protocol) {
39 $this->protocol
= $protocol;
43 public function getProtocol() {
44 return $this->protocol
;
47 public function setPath($path) {
52 public function getPath() {
56 public function setVersion($version) {
57 $this->version
= $version;
61 public function getVersion() {
62 return $this->version
;
65 public function getURI($to_path = null) {
66 $uri = id(new PhutilURI('http://'.$this->getHost()))
67 ->setProtocol($this->getProtocol())
68 ->setPort($this->getPort())
69 ->setPath($this->getPath());
72 $uri->appendPath($to_path);
77 public function getConnectionStatus() {
78 $status = $this->getEngine()->indexIsSane($this);
79 return $status ? parent
::STATUS_OKAY
: parent
::STATUS_FAIL
;