Skip to content

Commit 6d3cef7

Browse files
committed
Merge branch 'master' into task-support-es20
2 parents dbea4f6 + a063e0b commit 6d3cef7

26 files changed

Lines changed: 920 additions & 687 deletions
File renamed without changes.

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
language: php
22
matrix:
33
include:
4+
- php: 7.0
45
- php: 5.6
56
- php: 5.5
67
sudo: false
78
before_install:
89
- cd ..
9-
- wget --no-check-certificate https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.0.zip && unzip elasticsearch-1.7.0.zip
10-
- mv elasticsearch-1.7.0 elasticsearch
10+
- wget --no-check-certificate https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.zip && unzip elasticsearch-1.7.5.zip
11+
- mv elasticsearch-1.7.5 elasticsearch
1112
- cd elasticsearch
1213
- bin/elasticsearch -d
1314
- cd ..
1415
- git clone https://github.com/neos/neos-base-distribution.git
1516
- cd neos-base-distribution
1617
- composer require flowpack/elasticsearch-contentrepositoryadaptor dev-master
18+
- composer require typo3/typo3cr-search dev-master
1719
install:
1820
- composer install
1921
- cd ..
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?php
22
namespace Flowpack\ElasticSearch\ContentRepositoryAdaptor\Client;
33

4-
/* *
5-
* This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch.ContentRepositoryAdaptor". *
6-
* *
7-
* It is free software; you can redistribute it and/or modify it under *
8-
* the terms of the GNU Lesser General Public License, either version 3 *
9-
* of the License, or (at your option) any later version. *
10-
* *
11-
* The TYPO3 project - inspiring people to share! *
12-
* */
4+
/*
5+
* This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package.
6+
*
7+
* (c) Contributors of the Neos Project - www.neos.io
8+
*
9+
* This package is Open Source Software. For the full copyright and license
10+
* information, please view the LICENSE file which was distributed with this
11+
* source code.
12+
*/
1313

14+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\ElasticSearchClient;
15+
use Flowpack\ElasticSearch\Domain\Model\Client;
1416
use TYPO3\Flow\Annotations as Flow;
1517

1618
/**
@@ -29,10 +31,10 @@ class ClientFactory
2931
/**
3032
* Create a client
3133
*
32-
* @return \Flowpack\ElasticSearch\Domain\Model\Client
34+
* @return Client
3335
*/
3436
public function create()
3537
{
36-
return $this->clientFactory->create(null, 'Flowpack\ElasticSearch\ContentRepositoryAdaptor\ElasticSearchClient');
38+
return $this->clientFactory->create(null, ElasticSearchClient::class);
3739
}
3840
}

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Command/NodeIndexCommandController.php

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
<?php
22
namespace Flowpack\ElasticSearch\ContentRepositoryAdaptor\Command;
33

4-
/* *
5-
* This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch.ContentRepositoryAdaptor". *
6-
* *
7-
* It is free software; you can redistribute it and/or modify it under *
8-
* the terms of the GNU Lesser General Public License, either version 3 *
9-
* of the License, or (at your option) any later version. *
10-
* *
11-
* The TYPO3 project - inspiring people to share! *
12-
* */
4+
/*
5+
* This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package.
6+
*
7+
* (c) Contributors of the Neos Project - www.neos.io
8+
*
9+
* This package is Open Source Software. For the full copyright and license
10+
* information, please view the LICENSE file which was distributed with this
11+
* source code.
12+
*/
1313

14+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Mapping\NodeTypeMappingBuilder;
15+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Service\IndexWorkspaceTrait;
1416
use TYPO3\Flow\Annotations as Flow;
1517
use TYPO3\Flow\Cli\CommandController;
16-
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Mapping\NodeTypeMappingBuilder;
1718
use TYPO3\TYPO3CR\Domain\Model\NodeInterface;
18-
use TYPO3\TYPO3CR\Domain\Service\ContentDimensionCombinator;
19-
use TYPO3\TYPO3CR\Search\Indexer\NodeIndexingManager;
2019

2120
/**
2221
* Provides CLI features for index handling
@@ -25,18 +24,14 @@
2524
*/
2625
class NodeIndexCommandController extends CommandController
2726
{
27+
use IndexWorkspaceTrait;
28+
2829
/**
2930
* @Flow\Inject
3031
* @var \Flowpack\ElasticSearch\ContentRepositoryAdaptor\Indexer\NodeIndexer
3132
*/
3233
protected $nodeIndexer;
3334

34-
/**
35-
* @Flow\Inject
36-
* @var NodeIndexingManager
37-
*/
38-
protected $nodeIndexingManager;
39-
4035
/**
4136
* @Flow\Inject
4237
* @var \TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository
@@ -55,12 +50,6 @@ class NodeIndexCommandController extends CommandController
5550
*/
5651
protected $nodeFactory;
5752

58-
/**
59-
* @Flow\Inject
60-
* @var \TYPO3\TYPO3CR\Domain\Service\ContextFactory
61-
*/
62-
protected $contextFactory;
63-
6453
/**
6554
* @Flow\Inject
6655
* @var \TYPO3\Neos\Domain\Service\ContentDimensionPresetSourceInterface
@@ -90,12 +79,6 @@ class NodeIndexCommandController extends CommandController
9079
*/
9180
protected $configurationManager;
9281

93-
/**
94-
* @Flow\Inject
95-
* @var ContentDimensionCombinator
96-
*/
97-
protected $contentDimensionCombinator;
98-
9982
/**
10083
* @var array
10184
*/
@@ -189,6 +172,13 @@ public function buildCommand($limit = null, $update = false, $workspace = null,
189172
$workspace = 'live';
190173
}
191174

175+
$callback = function ($workspaceName, $indexedNodes, $dimensions) {
176+
if ($dimensions === []) {
177+
$this->outputLine('Workspace "' . $workspaceName . '" without dimensions done. (Indexed ' . $indexedNodes . ' nodes)');
178+
} else {
179+
$this->outputLine('Workspace "' . $workspaceName . '" and dimensions "' . json_encode($dimensions) . '" done. (Indexed ' . $indexedNodes . ' nodes)');
180+
}
181+
};
192182
if ($workspace === null) {
193183
foreach ($this->workspaceRepository->findAll() as $workspace) {
194184
$count += $this->indexWorkspace($workspace->getName());
@@ -232,13 +222,13 @@ public function cleanupCommand()
232222

233223
/**
234224
* @param string $workspaceName
235-
* @return void
225+
* @return int
236226
*/
237227
protected function indexWorkspace($workspaceName)
238228
{
239229
$indexedNodes = 0;
240230
$combinations = $this->contentDimensionCombinator->getAllAllowedCombinations();
241-
if ($combinations === array()) {
231+
if ($combinations === []) {
242232
$indexedNodes += $this->indexWorkspaceWithDimensions($workspaceName);
243233
} else {
244234
foreach ($combinations as $combination) {
@@ -252,17 +242,17 @@ protected function indexWorkspace($workspaceName)
252242
/**
253243
* @param string $workspaceName
254244
* @param array $dimensions
255-
* @return void
245+
* @return int
256246
*/
257-
protected function indexWorkspaceWithDimensions($workspaceName, array $dimensions = array())
247+
protected function indexWorkspaceWithDimensions($workspaceName, array $dimensions = [])
258248
{
259249
$indexedNodes = 0;
260-
$context = $this->contextFactory->create(array('workspaceName' => $workspaceName, 'dimensions' => $dimensions));
250+
$context = $this->contextFactory->create(['workspaceName' => $workspaceName, 'dimensions' => $dimensions]);
261251
$rootNode = $context->getRootNode();
262252

263253
$indexedNodes += $this->traverseNodes($rootNode);
264254

265-
if ($dimensions === array()) {
255+
if ($dimensions === []) {
266256
$this->outputLine('Workspace "' . $workspaceName . '" without dimensions done. (Indexed ' . $indexedNodes . ' nodes)');
267257
} else {
268258
$this->outputLine('Workspace "' . $workspaceName . '" and dimensions "' . json_encode($dimensions) . '" done. (Indexed ' . $indexedNodes . ' nodes)');

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Command/NodeTypeCommandController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
namespace Flowpack\ElasticSearch\ContentRepositoryAdaptor\Command;
33

4-
/* *
5-
* This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch.ContentRepositoryAdaptor". *
6-
* *
7-
* It is free software; you can redistribute it and/or modify it under *
8-
* the terms of the GNU Lesser General Public License, either version 3 *
9-
* of the License, or (at your option) any later version. *
10-
* *
11-
* The TYPO3 project - inspiring people to share! *
12-
* */
4+
/*
5+
* This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package.
6+
*
7+
* (c) Contributors of the Neos Project - www.neos.io
8+
*
9+
* This package is Open Source Software. For the full copyright and license
10+
* information, please view the LICENSE file which was distributed with this
11+
* source code.
12+
*/
1313

1414
use TYPO3\Flow\Annotations as Flow;
1515
use TYPO3\Flow\Cli\CommandController;
@@ -43,7 +43,7 @@ public function showCommand($nodeType = null)
4343
$configuration = $nodeType->getFullConfiguration();
4444
} else {
4545
$nodeTypes = $this->nodeTypeManager->getNodeTypes();
46-
$configuration = array();
46+
$configuration = [];
4747
/** @var \TYPO3\TYPO3CR\Domain\Model\NodeType $nodeType */
4848
foreach ($nodeTypes as $nodeTypeName => $nodeType) {
4949
$configuration[$nodeTypeName] = $nodeType->getFullConfiguration();

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Eel/ElasticSearchQuery.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
namespace Flowpack\ElasticSearch\ContentRepositoryAdaptor\Eel;
33

4-
/* *
5-
* This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch.ContentRepositoryAdaptor". *
6-
* *
7-
* It is free software; you can redistribute it and/or modify it under *
8-
* the terms of the GNU Lesser General Public License, either version 3 *
9-
* of the License, or (at your option) any later version. *
10-
* *
11-
* The TYPO3 project - inspiring people to share! *
12-
* */
4+
/*
5+
* This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package.
6+
*
7+
* (c) Contributors of the Neos Project - www.neos.io
8+
*
9+
* This package is Open Source Software. For the full copyright and license
10+
* information, please view the LICENSE file which was distributed with this
11+
* source code.
12+
*/
1313

1414
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception;
1515
use TYPO3\Flow\Persistence\QueryInterface;
@@ -30,6 +30,11 @@ class ElasticSearchQuery implements QueryInterface
3030
*/
3131
protected static $runtimeQueryResultCache;
3232

33+
/**
34+
* ElasticSearchQuery constructor.
35+
*
36+
* @param ElasticSearchQueryBuilder $elasticSearchQueryBuilder
37+
*/
3338
public function __construct(ElasticSearchQueryBuilder $elasticSearchQueryBuilder)
3439
{
3540
$this->queryBuilder = $elasticSearchQueryBuilder;
@@ -46,6 +51,7 @@ public function execute($cacheResult = false)
4651
}
4752
$queryResult = new ElasticSearchQueryResult($this);
4853
self::$runtimeQueryResultCache[$queryHash] = $queryResult;
54+
4955
return $queryResult;
5056
}
5157

0 commit comments

Comments
 (0)