Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

[FEATURE] Elastic 6.x support #167

Open
wants to merge 75 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
1832555
Merge pull request #165 from Codappix/release/0.0.7
Sep 27, 2018
7940da1
[TASK] Update elastica version pointer
bmoex Oct 2, 2018
a93a7af
[TASK] Add docprops to classes
bmoex Oct 2, 2018
acac544
[TASK] Remove deprecated _all field query for Elastic 6.x
bmoex Oct 3, 2018
d0bbfb8
[TASK] Add typolink to index
bmoex Oct 3, 2018
de5261f
[TASK] Add both form as list plugin seperate
bmoex Oct 4, 2018
1f0eae8
[TASK] Corectly index access group for query content
bmoex Oct 8, 2018
397a91e
[TASK] Add transparent background color for extension icon
bmoex Oct 10, 2018
e297d55
[!!!][FEATURE] Remap specific document type's to ES6 identifiers
bmoex Oct 11, 2018
404f49a
[TASK] Add opening for possible user access lookup
bmoex Oct 12, 2018
7566bf9
[FEATURE] Add Frontend User access query for secure search on elastic…
bmoex Oct 22, 2018
3f5273f
[BUGFIX] Make sure the while loop is not closed when filterRecordsByR…
bmoex Oct 22, 2018
519bc7e
[BUGFIX] Inherit access groups from parent pages when extended to sub…
bmoex Oct 24, 2018
028914e
[TASK] Finetune query for document_type instead of regex
bmoex Oct 24, 2018
a50cbf2
[TASK] Process feedback and fix unit-tests
bmoex Oct 24, 2018
628f76a
[BUGFIX] Use relative location of Fixtures
bmoex Oct 24, 2018
b70dd60
[TASK] Process own feedback based on tests
bmoex Oct 25, 2018
23f3d0d
[TASK] Add functional test for deleteDocuments functionality
bmoex Oct 26, 2018
b8de35a
[BUGFIX] Remove _all from unit tests
bmoex Oct 26, 2018
6e492d2
[FEATURE] Added flush command as indexation is now into one
bmoex Oct 26, 2018
a3ccc12
[TASK] Make sure CGL is correct
bmoex Oct 26, 2018
7b5a003
[TASK] Try composer update for travis build
bmoex Oct 26, 2018
35fdc69
[TASK] Enable elasticsearch version 6 for travis
bmoex Oct 26, 2018
0d14f80
[TASK] Remove support for TYPO3 7.6
bmoex Oct 26, 2018
577a562
TASK: Remove code base for TYPO3 7.x
DanielSiepmann Oct 27, 2018
e5e8f41
TASK: Prevent php warning for stdClass constant
DanielSiepmann Oct 27, 2018
30a34c4
FEATURE: Always accept comma separated list of identifiers on CLI
DanielSiepmann Oct 27, 2018
2c6521a
TASK: Fix phpdocs and type hints
DanielSiepmann Oct 27, 2018
5d5af73
TASK: Add missing license comments in PHP files
DanielSiepmann Oct 27, 2018
140dea3
TASK: Refactor code to use guards and decrease indentation
DanielSiepmann Oct 27, 2018
3074603
TASK: Use same order within all files for plugins
DanielSiepmann Oct 27, 2018
2d9062b
TASK: Streamline phpdoc
DanielSiepmann Oct 27, 2018
ab1b6b5
[TASK] Finetune so interface is not reliant for Elastica library
bmoex Oct 29, 2018
4000699
[TASK] Remove duplicate search_identifier in index
bmoex Oct 29, 2018
f1eb85d
[TASK] Remove double variables
bmoex Oct 29, 2018
9b0b030
[BUGFIX] Make sure the while loop is not closed
bmoex Oct 29, 2018
5250f97
[BUGFIX] Make sure boolean is returned for strict return type
bmoex Oct 29, 2018
4b7337d
[TASK] Use generic namespace for fluid
bmoex Oct 29, 2018
209f441
[TASK] Added link generation based on fluid templates
bmoex Oct 29, 2018
2c5ab1b
[TASK] Add documentation for frontend user access feature
bmoex Oct 29, 2018
2ee4a88
[TASK] Add objectmanager via constructor DI injection
bmoex Oct 29, 2018
b8d7088
[TASK] Revert to only one plugin based on feedback
bmoex Oct 29, 2018
ef43bc1
[FEATURE] Use interface for SearchService
bmoex Oct 29, 2018
615d24b
[TASK] Update unit tests for renaming controller initialize
bmoex Oct 30, 2018
3a2c700
[TASK] Remove unused constant
bmoex Oct 30, 2018
ee1f235
[TASK] Use filter interface for custom added filter
bmoex Oct 30, 2018
b63168b
[TASK] Remove unneeded pluginNamespace
bmoex Oct 30, 2018
2e327db
[TASK] Finetune QueryFactoryTest based on changes
bmoex Oct 30, 2018
4f7ccef
[TASK] Apply CGL changes
bmoex Oct 30, 2018
4da6e2f
[TASK] Add a little description howto extend configuration
bmoex Oct 31, 2018
f9ef8cb
Merge remote-tracking branch 'origin/develop' into feature/elastic-up…
DanielSiepmann Dec 27, 2018
8531f26
BUGFIX: Keep default action non cacheable
DanielSiepmann Dec 27, 2018
6f34ca2
BUGFIX: Keep necessary type hint for extbase
DanielSiepmann Dec 27, 2018
9c2db0b
TASK: Remove custom filter for fe group filtering
DanielSiepmann Dec 29, 2018
18cb95b
TASK: Update elasticsearch even further
DanielSiepmann Dec 29, 2018
ea8b4f4
TASK: Fix / improve some comments
DanielSiepmann Dec 29, 2018
13cd870
TASK: Refactor type handling for elasticsearch
DanielSiepmann Dec 29, 2018
a858d74
TASK: Shorten code
DanielSiepmann Dec 29, 2018
564ca15
TASK: Refactor code into common flow
DanielSiepmann Dec 29, 2018
12c3623
TASK: Cleanup TypoScript
DanielSiepmann Dec 29, 2018
89a558e
TASK: Improve documentation
DanielSiepmann Dec 29, 2018
831da6a
TASK: Use new SearchRequestInterface everywhere
DanielSiepmann Dec 29, 2018
f95723f
TASK: Fix unit tests
DanielSiepmann Dec 29, 2018
97160da
TASK: Use php 7 anonymous function call
DanielSiepmann Dec 29, 2018
8c33c8c
TASK: Remove unused file / php class
DanielSiepmann Dec 29, 2018
43254c1
TASK: Fix license and php doc
DanielSiepmann Dec 29, 2018
28a8dd1
TASK: rephrase indice to index.
DanielSiepmann Dec 30, 2018
689f293
TASK: Finish deletion of index and documents feature
DanielSiepmann Dec 30, 2018
7f2249e
TASK: Use a single array utility
DanielSiepmann Dec 30, 2018
09cbaed
TASK: Remove unused code
DanielSiepmann Dec 30, 2018
1efb06d
TASK: Remove wrong phpdoc
DanielSiepmann Dec 30, 2018
a6f7f31
TASK: Do not publish internal method
DanielSiepmann Dec 30, 2018
4c99009
TASK: Remove cache implementation
DanielSiepmann Dec 30, 2018
f955a9b
FEATURE: Provide basic caching
DanielSiepmann Dec 30, 2018
73d61bd
FEATURE: Provide more information about concept
DanielSiepmann Dec 30, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ addons:
packages:
- oracle-java8-set-default
before_install:
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.0.deb && sudo dpkg -i --force-confnew elasticsearch-5.2.0.deb && sudo service elasticsearch restart
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.deb && sudo dpkg -i --force-confnew elasticsearch-6.5.4.deb && sudo service elasticsearch restart
- mysql -u root -e 'GRANT ALL ON `typo3_ci_ft%`.* TO [email protected];'

language: php
Expand All @@ -26,7 +26,6 @@ env:
- typo3DatabaseUsername="travis"
- typo3DatabasePassword=""
matrix:
- TYPO3_VERSION="~7.6"
- TYPO3_VERSION="~8.7"

matrix:
Expand Down
62 changes: 45 additions & 17 deletions Classes/Command/IndexCommandController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Codappix\SearchCore\Command;

/*
Expand All @@ -21,7 +22,9 @@
*/

use Codappix\SearchCore\Domain\Index\IndexerFactory;
use Codappix\SearchCore\Domain\Index\IndexerInterface;
use Codappix\SearchCore\Domain\Index\NoMatchingIndexerException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;

/**
Expand All @@ -43,32 +46,57 @@ public function injectIndexerFactory(IndexerFactory $factory)
}

/**
* Will index the given identifier.
* Will index all documents for the given identifiers.
*
* @param string $identifier
* @param string $identifier Comma separated list of identifiers.
*/
public function indexCommand(string $identifier)
public function indexCommand(string $identifiers)
{
try {
$this->indexerFactory->getIndexer($identifier)->indexAllDocuments();
$this->outputLine($identifier . ' was indexed.');
} catch (NoMatchingIndexerException $e) {
$this->outputLine('No indexer found for: ' . $identifier);
}
$this->executeForIdentifier($identifiers, function (IndexerInterface $indexer) {
$indexer->indexAllDocuments();
$this->outputLine('Documents in index ' . $indexer->getIdentifier() . ' were indexed.');
});
}

/**
* Will delete all indexed documents for the given identifiers.
*
* @param string $identifier Comma separated list of identifiers.
*/
public function deleteDocumentsCommand(string $identifiers)
{
$this->executeForIdentifier($identifiers, function (IndexerInterface $indexer) {
$indexer->deleteAllDocuments();
$this->outputLine('Documents in index ' . $indexer->getIdentifier() . ' were deleted.');
});
}

/**
* Will delete the index for given identifiers.
*
* @param string $identifier Comma separated list of identifiers.
*/
public function deleteCommand(string $identifiers = 'pages')
{
$this->executeForIdentifier($identifiers, function (IndexerInterface $indexer) {
$indexer->delete();
$this->outputLine('Index ' . $indexer->getIdentifier() . ' was deleted.');
});
}

/**
* Will delete the given identifier.
* Executes the given callback method for each provided identifier.
*
* @param string $identifier
* An indexer is created for each identifier, which is provided as first argument to the callback.
*/
public function deleteCommand(string $identifier)
private function executeForIdentifier(string $identifiers, callable $callback)
{
try {
$this->indexerFactory->getIndexer($identifier)->delete();
$this->outputLine($identifier . ' was deleted.');
} catch (NoMatchingIndexerException $e) {
$this->outputLine('No indexer found for: ' . $identifier);
foreach (GeneralUtility::trimExplode(',', $identifiers, true) as $identifier) {
try {
$callback($this->indexerFactory->getIndexer($identifier));
} catch (NoMatchingIndexerException $e) {
$this->outputLine('No indexer found for: ' . $identifier . '.');
}
}
}
}
56 changes: 0 additions & 56 deletions Classes/Compatibility/ImplementationRegistrationService.php

This file was deleted.

31 changes: 0 additions & 31 deletions Classes/Compatibility/TypoScriptService.php

This file was deleted.

31 changes: 0 additions & 31 deletions Classes/Compatibility/TypoScriptService76.php

This file was deleted.

30 changes: 0 additions & 30 deletions Classes/Compatibility/TypoScriptServiceInterface.php

This file was deleted.

23 changes: 19 additions & 4 deletions Classes/Configuration/ConfigurationContainer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Codappix\SearchCore\Configuration;

/*
Expand All @@ -20,12 +21,12 @@
* 02110-1301, USA.
*/

use Codappix\SearchCore\Utility\ArrayUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Utility\ArrayUtility;

/**
* Container of all configurations for extension.
* Always inject this to have a single place for configuration and parsing only once.
* Always inject this to have a single place for configuration.
*/
class ConfigurationContainer implements ConfigurationContainerInterface
{
Expand Down Expand Up @@ -59,7 +60,7 @@ public function injectConfigurationManager(ConfigurationManagerInterface $config
*/
public function get(string $path)
{
$value = ArrayUtility::getValueByPath($this->settings, $path);
$value = $this->getValueByPath($path);

if ($value === null) {
throw new InvalidArgumentException(
Expand All @@ -77,6 +78,20 @@ public function get(string $path)
*/
public function getIfExists(string $path)
{
return ArrayUtility::getValueByPath($this->settings, $path);
return $this->getValueByPath($path);
}

/**
* @param string $path In dot notation.
* @return mixed|null Null if no entry was found.
*/
protected function getValueByPath(string $path)
{
try {
return ArrayUtility::getValueByPath($this->settings, $path, '.');
} catch (\Exception $e) {
// Catch all exceptions to safely handle path retrieval
}
return null;
}
}
3 changes: 2 additions & 1 deletion Classes/Configuration/ConfigurationContainerInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Codappix\SearchCore\Configuration;

/*
Expand Down Expand Up @@ -41,7 +42,7 @@ public function get(string $path);
* Same as get but will not throw an exception but return null.
*
* @param string $path In dot notation.
* @return mixed|null
* @return mixed|null Null if it does not exist.
*/
public function getIfExists(string $path);
}
10 changes: 5 additions & 5 deletions Classes/Configuration/ConfigurationUtility.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Codappix\SearchCore\Configuration;

/*
Expand Down Expand Up @@ -28,7 +29,7 @@ class ConfigurationUtility
/**
* Will parse all entries, recursive as fluid template, with request variable set to $searchRequest.
*/
public function replaceArrayValuesWithRequestContent(SearchRequestInterface $searchRequest, array $array) : array
public function replaceArrayValuesWithRequestContent(SearchRequestInterface $searchRequest, array $array): array
{
array_walk_recursive($array, function (&$value, $key, SearchRequestInterface $searchRequest) {
$template = new StandaloneView();
Expand All @@ -38,7 +39,7 @@ public function replaceArrayValuesWithRequestContent(SearchRequestInterface $sea

// As elasticsearch does need some doubles to be send as doubles.
if (is_numeric($value)) {
$value = (float) $value;
$value = (float)$value;
}
}, $searchRequest);

Expand All @@ -49,13 +50,12 @@ public function replaceArrayValuesWithRequestContent(SearchRequestInterface $sea
* Will check all entries, whether they have a condition and filter entries out, where condition is false.
* Also will remove condition in the end.
*/
public function filterByCondition(array $entries) : array
public function filterByCondition(array $entries): array
{
$entries = array_filter($entries, function ($entry) {
return !is_array($entry)
|| !array_key_exists('condition', $entry)
|| (bool) $entry['condition'] === true
;
|| (bool)$entry['condition'] === true;
});

foreach ($entries as $key => $entry) {
Expand Down
1 change: 1 addition & 0 deletions Classes/Configuration/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Codappix\SearchCore\Configuration;

/*
Expand Down
1 change: 1 addition & 0 deletions Classes/Configuration/NoConfigurationException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Codappix\SearchCore\Configuration;

/*
Expand Down
Loading