@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Pass URI to Elastic engine from outside

Summary:
We need to generate the URI dynamically.
This code is also generally better.

Test Plan: Created custom search selector passing the custom URI to engine.

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2655

vrana 06b0f0d8 76d758c0

+10 -5
+6 -2
src/applications/search/engine/PhabricatorSearchEngineElastic.php
··· 17 17 */ 18 18 19 19 final class PhabricatorSearchEngineElastic extends PhabricatorSearchEngine { 20 + private $uri; 21 + 22 + public function __construct($uri) { 23 + $this->uri = $uri; 24 + } 20 25 21 26 public function reindexAbstractDocument( 22 27 PhabricatorSearchAbstractDocument $doc) { ··· 183 188 } 184 189 185 190 private function executeRequest($path, array $data, $is_write = false) { 186 - $uri = PhabricatorEnv::getEnvConfig('search.elastic.host'); 187 - $uri = new PhutilURI($uri); 191 + $uri = new PhutilURI($this->uri); 188 192 $data = json_encode($data); 189 193 190 194 $uri->setPath($path);
+4 -3
src/applications/search/selector/PhabricatorDefaultSearchEngineSelector.php
··· 1 1 <?php 2 2 3 3 /* 4 - * Copyright 2011 Facebook, Inc. 4 + * Copyright 2012 Facebook, Inc. 5 5 * 6 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 7 * you may not use this file except in compliance with the License. ··· 23 23 extends PhabricatorSearchEngineSelector { 24 24 25 25 public function newEngine() { 26 - if (PhabricatorEnv::getEnvConfig('search.elastic.host')) { 27 - return new PhabricatorSearchEngineElastic(); 26 + $elastic_host = PhabricatorEnv::getEnvConfig('search.elastic.host'); 27 + if ($elastic_host) { 28 + return new PhabricatorSearchEngineElastic($elastic_host); 28 29 } 29 30 return new PhabricatorSearchEngineMySQL(); 30 31 }