/** * Injects the settings from the yaml file into * @param array $settings */ public function injectSettings(array $settings) { $this->settings = $settings; $this->connection = new Es\ElasticSearchConnection(); $this->connection->init(); $this->redmineClient = new Redmine\Client($this->settings['Redmine']['url'], $this->settings['Redmine']['apiKey']); }
/** * Initializes the controller */ protected function initializeAction() { $context = $this->env->getContext(); if ($context == 'Development') { $this->context = 'DEV'; } else { $this->context = 'PRD'; } $this->connection = new Es\ElasticSearchConnection(); $this->connection->init(); }
/** * Initializes all client connections to forge and to Elasticsearch * * @param string $mode * @throws \TYPO3\Flow\Exception */ protected function startUp($mode = '') { if ($mode === 'elevated') { $this->redmineClient = new Redmine\Client($this->settings['Redmine']['url'], $this->settings['Redmine']['apiKeyElevated']); } else { $this->redmineClient = new Redmine\Client($this->settings['Redmine']['url'], $this->settings['Redmine']['apiKey']); } $this->connection = new ElasticSearchConnection(); $this->connection->init(); $this->elasticIndex = $this->connection->getIndex(); $this->lockFile = FLOW_PATH_DATA . 'Persistent/WMDB.Forger.lock'; }
/** * Initializes the controller */ protected function initializeAction() { date_default_timezone_set('UTC'); $context = $this->env->getContext(); if ($context == 'Development') { $this->context = 'DEV'; } else { $this->context = 'PRD'; } $this->connection = new Es\ElasticSearchConnection(); $this->connection->init(); $this->sprintConfig = $this->ConfigurationManager->getConfiguration('Sprints'); }
protected function initializeAction() { date_default_timezone_set('UTC'); $this->connection = new Es\ElasticSearchConnection(); $this->connection->init(); $context = $this->env->getContext(); if ($context == 'Development') { $this->context = 'DEV'; } else { $this->context = 'PRD'; } if (isset($_GET['page'])) { $this->currentPage = intval($_GET['page']); } }
/** * @param $searchClosed * @return \Elastica\ResultSet * @throws Exception */ public function doSearch($searchClosed) { $this->connection = new ElasticSearchConnection(); $this->connection->init(); $this->whereClause = new Query\QueryString(); $this->whereClause->setQuery($this->searchTerms); $this->utility = new Util(); if (isset($_GET['page'])) { $this->currentPage = intval($_GET['page']); } $this->fieldMapping = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'WMDB.Forger.SearchTermMapping'); $elasticaQuery = new Query(); if ($searchClosed === 'true') { $elasticaQuery->setQuery($this->whereClause); } else { $boolSearch = new Query\Bool(); $boolSearch->addMust($this->whereClause); $boolSearch->addMustNot(['term' => ['status.name' => 'Closed']]); $boolSearch->addMustNot(['term' => ['status.name' => 'Rejected']]); $boolSearch->addMustNot(['term' => ['status.name' => 'Resolved']]); $elasticaQuery->setQuery($boolSearch); } $elasticaQuery->setSize($this->perPage); $elasticaQuery->setFrom($this->currentPage * $this->perPage - $this->perPage); $usedFilters = $this->addFilters(); if ($usedFilters !== false) { $elasticaQuery->setPostFilter($usedFilters); } $this->addAggregations($elasticaQuery); $elasticaResultSet = $this->connection->getIndex()->search($elasticaQuery); $results = $elasticaResultSet->getResults(); $maxScore = $elasticaResultSet->getMaxScore(); $aggs = $elasticaResultSet->getAggregations(); $this->totalHits = $elasticaResultSet->getTotalHits(); $out = array('pagesToLinkTo' => $this->getPages(), 'currentPage' => $this->currentPage, 'prev' => $this->currentPage - 1, 'next' => $this->currentPage < ceil($this->totalHits / $this->perPage) ? $this->currentPage + 1 : 0, 'totalResults' => $this->totalHits, 'startingAtItem' => $this->currentPage * $this->perPage - ($this->perPage - 1), 'endingAtItem' => $this->currentPage * $this->perPage, 'results' => $results, 'maxScore' => $maxScore, 'aggs' => $aggs); if (intval($this->totalHits) <= intval($out['endingAtItem'])) { $out['endingAtItem'] = intval($this->totalHits); } return $out; }
/** * @throws \TYPO3\Flow\Exception */ public function __construct() { $this->connection = new Es\ElasticSearchConnection(); $this->connection->init(); }
/** * @return \Elastica\Index * @throws \TYPO3\Flow\Exception */ protected function connectToElastic() { $connection = new ElasticSearch\ElasticSearchConnection(); $connection->init(); return $connection->getIndex(); }
/** * @param int $issueId * @return array|string */ private function findIssue($issueId) { $con = new ElasticSearchConnection(); $con->init(); $index = $con->getIndex(); $forger = $index->getType('issue'); try { $res = $forger->getDocument($issueId); // Need to use an ugly hack // funny noone found that one earlier // \TYPO3\Flow\var_dump($res); $data = $res->getData(); $this->view->assign('issue', ['hit' => ['_source' => $data]]); } catch (\Exception $e) { $data = array('error' => 'Issue #' . $issueId . ' was not found.'); } return $data; }