mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-26 22:56:12 +01:00
TASK: Streamline phpdoc
* Do not add duplicate information from PHP to phpdoc. * Do not add useless comments like "this is a constructor of class x".
This commit is contained in:
parent
30746038c3
commit
2d9062b6e3
51 changed files with 28 additions and 791 deletions
|
@ -39,7 +39,6 @@ class IndexCommandController extends CommandController
|
|||
|
||||
/**
|
||||
* @param IndexerFactory $factory
|
||||
* @return void
|
||||
*/
|
||||
public function injectIndexerFactory(IndexerFactory $factory)
|
||||
{
|
||||
|
@ -50,7 +49,6 @@ class IndexCommandController extends CommandController
|
|||
* Will index all documents for the given identifiers.
|
||||
*
|
||||
* @param string $identifier Comma separated list of identifiers.
|
||||
* @return void
|
||||
*/
|
||||
public function indexCommand(string $identifiers)
|
||||
{
|
||||
|
@ -64,7 +62,6 @@ class IndexCommandController extends CommandController
|
|||
* Will delete all indexed documents for the given identifiers.
|
||||
*
|
||||
* @param string $identifier Comma separated list of identifiers.
|
||||
* @return void
|
||||
*/
|
||||
public function deleteCommand(string $identifiers)
|
||||
{
|
||||
|
@ -78,7 +75,6 @@ class IndexCommandController extends CommandController
|
|||
* Will delete the full index for given identifiers.
|
||||
*
|
||||
* @param string $identifier Comma separated list of identifiers.
|
||||
* @return void
|
||||
*/
|
||||
public function flushCommand(string $identifiers = 'pages')
|
||||
{
|
||||
|
|
|
@ -39,8 +39,6 @@ class ConfigurationContainer implements ConfigurationContainerInterface
|
|||
|
||||
/**
|
||||
* Inject settings via ConfigurationManager.
|
||||
*
|
||||
* @param ConfigurationManagerInterface $configurationManager
|
||||
*/
|
||||
public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
|
||||
{
|
||||
|
@ -83,8 +81,8 @@ class ConfigurationContainer implements ConfigurationContainerInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @return mixed
|
||||
* @param string $path In dot notation.
|
||||
* @return mixed|null Null if no entry was found.
|
||||
*/
|
||||
protected function getValueByPath(string $path)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ interface ConfigurationContainerInterface
|
|||
* 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);
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@ class ConfigurationUtility
|
|||
{
|
||||
/**
|
||||
* Will parse all entries, recursive as fluid template, with request variable set to $searchRequest.
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public function replaceArrayValuesWithRequestContent(SearchRequestInterface $searchRequest, array $array): array
|
||||
{
|
||||
|
@ -53,9 +49,6 @@ class ConfigurationUtility
|
|||
/**
|
||||
* Will check all entries, whether they have a condition and filter entries out, where condition is false.
|
||||
* Also will remove condition in the end.
|
||||
*
|
||||
* @param array $entries
|
||||
* @return array
|
||||
*/
|
||||
public function filterByCondition(array $entries): array
|
||||
{
|
||||
|
|
|
@ -30,19 +30,11 @@ interface ConnectionInterface
|
|||
{
|
||||
/**
|
||||
* Will add a new document.
|
||||
*
|
||||
* @param string $documentType
|
||||
* @param array $document
|
||||
* @return void
|
||||
*/
|
||||
public function addDocument(string $documentType, array $document);
|
||||
|
||||
/**
|
||||
* Add the given documents.
|
||||
*
|
||||
* @param string $documentType
|
||||
* @param array $documents
|
||||
* @return void
|
||||
*/
|
||||
public function addDocuments(string $documentType, array $documents);
|
||||
|
||||
|
@ -50,10 +42,6 @@ interface ConnectionInterface
|
|||
* Will update an existing document.
|
||||
*
|
||||
* NOTE: Batch updating is not yet supported.
|
||||
*
|
||||
* @param string $documentType
|
||||
* @param array $document
|
||||
* @return void
|
||||
*/
|
||||
public function updateDocument(string $documentType, array $document);
|
||||
|
||||
|
@ -61,33 +49,21 @@ interface ConnectionInterface
|
|||
* Will remove an existing document.
|
||||
*
|
||||
* NOTE: Batch deleting is not yet supported.
|
||||
*
|
||||
* @param string $documentType
|
||||
* @param string $identifier
|
||||
* @return void
|
||||
*/
|
||||
public function deleteDocument(string $documentType, string $identifier);
|
||||
|
||||
/**
|
||||
* Search by given request and return result.
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return SearchResultInterface
|
||||
*/
|
||||
public function search(SearchRequestInterface $searchRequest): SearchResultInterface;
|
||||
|
||||
/**
|
||||
* Will delete the whole index / db.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteIndex();
|
||||
|
||||
/**
|
||||
* Will delete the index / db of defined document type.
|
||||
*
|
||||
* @param Query $query
|
||||
* @return void
|
||||
*/
|
||||
public function deleteIndexByQuery(Query $query);
|
||||
}
|
||||
|
|
|
@ -114,10 +114,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
$this->queryFactory = $queryFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
* @param array $document
|
||||
*/
|
||||
public function addDocument(string $documentType, array $document)
|
||||
{
|
||||
$this->withType(
|
||||
|
@ -128,10 +124,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function deleteDocument(string $documentType, string $identifier)
|
||||
{
|
||||
try {
|
||||
|
@ -149,10 +141,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
* @param array $document
|
||||
*/
|
||||
public function updateDocument(string $documentType, array $document)
|
||||
{
|
||||
$this->withType(
|
||||
|
@ -163,10 +151,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
* @param array $documents
|
||||
*/
|
||||
public function addDocuments(string $documentType, array $documents)
|
||||
{
|
||||
$this->withType(
|
||||
|
@ -177,9 +161,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function deleteIndex()
|
||||
{
|
||||
$index = $this->connection->getClient()->getIndex($this->indexFactory->getIndexName());
|
||||
|
@ -195,10 +176,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
$index->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Query $query
|
||||
* @return void
|
||||
*/
|
||||
public function deleteIndexByQuery(Query $query)
|
||||
{
|
||||
$index = $this->connection->getClient()->getIndex($this->indexFactory->getIndexName());
|
||||
|
@ -218,9 +195,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
|
||||
/**
|
||||
* Execute given callback with Elastica Type based on provided documentType
|
||||
*
|
||||
* @param string $documentType
|
||||
* @param callable $callback
|
||||
*/
|
||||
protected function withType(string $documentType, callable $callback)
|
||||
{
|
||||
|
@ -236,10 +210,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
$type->getIndex()->refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return SearchResultInterface
|
||||
*/
|
||||
public function search(SearchRequestInterface $searchRequest): SearchResultInterface
|
||||
{
|
||||
$this->logger->debug('Search for', [$searchRequest->getSearchTerm()]);
|
||||
|
@ -251,10 +221,6 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
return $this->objectManager->get(SearchResult::class, $searchRequest, $search->search());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
* @return \Elastica\Type
|
||||
*/
|
||||
protected function getType($documentType): \Elastica\Type
|
||||
{
|
||||
return $this->typeFactory->getType(
|
||||
|
|
|
@ -46,17 +46,14 @@ class DocumentFactory implements Singleton
|
|||
/**
|
||||
* Creates document from document.
|
||||
*
|
||||
* @param string $documentType
|
||||
* @param array $document
|
||||
* @return \Elastica\Document
|
||||
* @throws \Exception
|
||||
* @throws \InvalidArgumentException If no search identifier was provided.
|
||||
*/
|
||||
public function getDocument(string $documentType, array $document): \Elastica\Document
|
||||
{
|
||||
// TODO: Use DocumentType for further configuration.
|
||||
|
||||
if (!isset($document['search_identifier'])) {
|
||||
throw new \Exception('No search_identifier provided for document.', 1481194385);
|
||||
throw new \InvalidArgumentException('No search_identifier provided for document.', 1481194385);
|
||||
}
|
||||
|
||||
$identifier = $document['search_identifier'];
|
||||
|
@ -70,10 +67,8 @@ class DocumentFactory implements Singleton
|
|||
|
||||
/**
|
||||
* Creates documents based on documents.
|
||||
* @param string $documentType
|
||||
* @param array $documents
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*
|
||||
* @throws \InvalidArgumentException If no search identifier was provided.
|
||||
*/
|
||||
public function getDocuments(string $documentType, array $documents): array
|
||||
{
|
||||
|
|
|
@ -46,12 +46,6 @@ class Facet implements FacetInterface
|
|||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* Facet constructor.
|
||||
* @param string $name
|
||||
* @param array $aggregation
|
||||
* @param ConfigurationContainerInterface $configuration
|
||||
*/
|
||||
public function __construct(string $name, array $aggregation, ConfigurationContainerInterface $configuration)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
@ -66,17 +60,11 @@ class Facet implements FacetInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getField(): string
|
||||
{
|
||||
return $this->field;
|
||||
|
@ -94,9 +82,6 @@ class Facet implements FacetInterface
|
|||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function initOptions()
|
||||
{
|
||||
if (is_array($this->options)) {
|
||||
|
|
|
@ -40,9 +40,6 @@ class FacetOption implements FacetOptionInterface
|
|||
*/
|
||||
protected $count = 0;
|
||||
|
||||
/**
|
||||
* @param array $bucket
|
||||
*/
|
||||
public function __construct(array $bucket)
|
||||
{
|
||||
$this->name = $bucket['key'];
|
||||
|
@ -50,9 +47,6 @@ class FacetOption implements FacetOptionInterface
|
|||
$this->count = $bucket['doc_count'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
|
|
|
@ -63,8 +63,6 @@ class IndexFactory implements Singleton
|
|||
|
||||
/**
|
||||
* Get the index name from the typoscript settings.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIndexName(): string
|
||||
{
|
||||
|
@ -72,11 +70,7 @@ class IndexFactory implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an index bases on TYPO3 table name.
|
||||
*
|
||||
* @param Connection $connection
|
||||
* @param string $documentType
|
||||
* @return \Elastica\Index
|
||||
* Get an index based on TYPO3 table name.
|
||||
*/
|
||||
public function getIndex(Connection $connection, string $documentType): \Elastica\Index
|
||||
{
|
||||
|
@ -92,10 +86,6 @@ class IndexFactory implements Singleton
|
|||
return $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfigurationFor(string $documentType): array
|
||||
{
|
||||
try {
|
||||
|
@ -117,10 +107,6 @@ class IndexFactory implements Singleton
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $analyzer
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareAnalyzerConfiguration(array $analyzer): array
|
||||
{
|
||||
$fieldsToExplode = ['char_filter', 'filter', 'word_list'];
|
||||
|
|
|
@ -45,10 +45,6 @@ class MappingFactory implements Singleton
|
|||
|
||||
/**
|
||||
* Get an mapping based on type.
|
||||
*
|
||||
* @param \Elastica\Type $type
|
||||
* @param string $documentType
|
||||
* @return \Elastica\Type\Mapping
|
||||
*/
|
||||
public function getMapping(\Elastica\Type $type, string $documentType = null): \Elastica\Type\Mapping
|
||||
{
|
||||
|
@ -61,10 +57,6 @@ class MappingFactory implements Singleton
|
|||
return $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfiguration(string $identifier): array
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -63,13 +63,6 @@ class SearchResult implements SearchResultInterface
|
|||
*/
|
||||
protected $objectManager;
|
||||
|
||||
/**
|
||||
* SearchResult constructor.
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param \Elastica\ResultSet $result
|
||||
* @param ObjectManagerInterface $objectManager
|
||||
*/
|
||||
public function __construct(
|
||||
SearchRequestInterface $searchRequest,
|
||||
\Elastica\ResultSet $result,
|
||||
|
@ -102,17 +95,11 @@ class SearchResult implements SearchResultInterface
|
|||
return $this->facets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurrentCount(): int
|
||||
{
|
||||
return $this->result->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function initResults()
|
||||
{
|
||||
if (is_array($this->results)) {
|
||||
|
@ -125,9 +112,6 @@ class SearchResult implements SearchResultInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function initFacets()
|
||||
{
|
||||
if (is_array($this->facets)) {
|
||||
|
@ -207,7 +191,7 @@ class SearchResult implements SearchResultInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @return SearchRequestInterface|\TYPO3\CMS\Extbase\Persistence\QueryInterface
|
||||
* @return SearchRequestInterface
|
||||
*/
|
||||
public function getQuery()
|
||||
{
|
||||
|
|
|
@ -32,9 +32,6 @@ class TypeFactory implements Singleton
|
|||
{
|
||||
/**
|
||||
* Get an index bases on TYPO3 table name.
|
||||
* @param \Elastica\Index $index
|
||||
* @param string $documentType
|
||||
* @return \Elastica\Type
|
||||
*/
|
||||
public function getType(\Elastica\Index $index, string $documentType): \Elastica\Type
|
||||
{
|
||||
|
|
|
@ -26,9 +26,6 @@ namespace Codappix\SearchCore\Connection;
|
|||
*/
|
||||
interface FacetInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,23 +29,17 @@ interface FacetOptionInterface
|
|||
/**
|
||||
* Returns the name of this option. Equivalent
|
||||
* to value used for filtering.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* If a pre-rendered name is provided, this will be returned.
|
||||
* Otherwise it's the same as getName().
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName(): string;
|
||||
|
||||
/**
|
||||
* Returns the number of found results for this option.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCount(): int;
|
||||
}
|
||||
|
|
|
@ -29,15 +29,11 @@ interface FacetRequestInterface
|
|||
/**
|
||||
* The identifier of the facet, used as key in arrays and to get the facet
|
||||
* from search request, etc.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifier(): string;
|
||||
|
||||
/**
|
||||
* The config to use for facet building.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig(): array;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ interface ResultItemInterface extends \ArrayAccess
|
|||
* Provide key/column/field => data.
|
||||
*
|
||||
* Used e.g. for dataprocessing.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPlainData(): array;
|
||||
|
||||
|
@ -42,8 +40,6 @@ interface ResultItemInterface extends \ArrayAccess
|
|||
*
|
||||
* That should make it easier to differentiate if multiple
|
||||
* types are returned for one query.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string;
|
||||
}
|
||||
|
|
|
@ -28,31 +28,15 @@ interface SearchRequestInterface extends QueryInterface
|
|||
{
|
||||
/**
|
||||
* Returns the actual string the user searched for.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSearchTerm(): string;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasFilter(): bool;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFilter(): array;
|
||||
|
||||
/**
|
||||
* @param array $filter
|
||||
* @return void
|
||||
*/
|
||||
public function setFilter(array $filter);
|
||||
|
||||
/**
|
||||
* @param FacetRequestInterface $facet
|
||||
* @return void
|
||||
*/
|
||||
public function addFacet(FacetRequestInterface $facet);
|
||||
|
||||
/**
|
||||
|
@ -63,18 +47,12 @@ interface SearchRequestInterface extends QueryInterface
|
|||
/**
|
||||
* Workaround for paginate widget support which will
|
||||
* use the request to build another search.
|
||||
*
|
||||
* @param ConnectionInterface $connection
|
||||
* @return void
|
||||
*/
|
||||
public function setConnection(ConnectionInterface $connection);
|
||||
|
||||
/**
|
||||
* Workaround for paginate widget support which will
|
||||
* use the request to build another search.
|
||||
*
|
||||
* @param SearchService $searchService
|
||||
* @return void
|
||||
*/
|
||||
public function setSearchService(SearchService $searchService);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ interface SearchResultInterface extends \Iterator, \Countable, QueryResultInterf
|
|||
|
||||
/**
|
||||
* Returns the number of results in current result
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurrentCount(): int;
|
||||
}
|
||||
|
|
|
@ -45,10 +45,6 @@ class SearchController extends ActionController
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
|
||||
* @return void
|
||||
*/
|
||||
public function initializeSearchAction()
|
||||
{
|
||||
if (isset($this->settings['searching']['mode'])
|
||||
|
@ -68,31 +64,22 @@ class SearchController extends ActionController
|
|||
}
|
||||
|
||||
/**
|
||||
* Action: Search form
|
||||
*
|
||||
* @param SearchRequest $searchRequest
|
||||
* @return void
|
||||
* Display results and deliver original request and result to view.
|
||||
*/
|
||||
public function formAction(SearchRequest $searchRequest = null)
|
||||
{
|
||||
$searchResult = null;
|
||||
if ($searchRequest !== null) {
|
||||
$searchResult = $this->searchService->search($searchRequest);
|
||||
}
|
||||
|
||||
$this->view->assignMultiple([
|
||||
'searchRequest' => $searchRequest,
|
||||
'searchResult' => $searchResult,
|
||||
]);
|
||||
$this->action($searchRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action: Display list results and deliver original request and result to view.
|
||||
*
|
||||
* @param SearchRequest $searchRequest
|
||||
* @return void
|
||||
* Display results and deliver original request and result to view.
|
||||
*/
|
||||
public function resultsAction(SearchRequest $searchRequest = null)
|
||||
{
|
||||
$this->action($searchRequest);
|
||||
}
|
||||
|
||||
private function action(SearchRequest $searchRequest = null)
|
||||
{
|
||||
$searchResult = null;
|
||||
if ($searchRequest !== null) {
|
||||
|
|
|
@ -35,20 +35,11 @@ class ContentObjectDataProcessorAdapterProcessor implements ProcessorInterface
|
|||
*/
|
||||
protected $typoScriptService;
|
||||
|
||||
/**
|
||||
* ContentObjectDataProcessorAdapterProcessor constructor.
|
||||
* @param TypoScriptService $typoScriptService
|
||||
*/
|
||||
public function __construct(TypoScriptService $typoScriptService)
|
||||
{
|
||||
$this->typoScriptService = $typoScriptService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
*/
|
||||
public function processData(array $data, array $configuration): array
|
||||
{
|
||||
$dataProcessor = GeneralUtility::makeInstance($configuration['_dataProcessor']);
|
||||
|
|
|
@ -26,11 +26,6 @@ namespace Codappix\SearchCore\DataProcessing;
|
|||
*/
|
||||
class CopyToProcessor implements ProcessorInterface
|
||||
{
|
||||
/**
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
*/
|
||||
public function processData(array $record, array $configuration): array
|
||||
{
|
||||
$target = [];
|
||||
|
@ -52,11 +47,6 @@ class CopyToProcessor implements ProcessorInterface
|
|||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $target
|
||||
* @param array $from
|
||||
* @return void
|
||||
*/
|
||||
protected function addArray(array &$target, array $from)
|
||||
{
|
||||
foreach ($from as $value) {
|
||||
|
|
|
@ -26,11 +26,6 @@ namespace Codappix\SearchCore\DataProcessing;
|
|||
*/
|
||||
class GeoPointProcessor implements ProcessorInterface
|
||||
{
|
||||
/**
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
*/
|
||||
public function processData(array $record, array $configuration): array
|
||||
{
|
||||
if (!$this->isApplyable($record, $configuration)) {
|
||||
|
@ -45,11 +40,6 @@ class GeoPointProcessor implements ProcessorInterface
|
|||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return bool
|
||||
*/
|
||||
protected function isApplyable(array $record, array $configuration): bool
|
||||
{
|
||||
if (!isset($record[$configuration['lat']])
|
||||
|
|
|
@ -29,9 +29,6 @@ interface ProcessorInterface
|
|||
/**
|
||||
* Processes the given data.
|
||||
* Also retrieves the configuration for this processor instance.
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
*/
|
||||
public function processData(array $record, array $configuration): array;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|||
*/
|
||||
class RemoveProcessor implements ProcessorInterface
|
||||
{
|
||||
/**
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
*/
|
||||
public function processData(array $record, array $configuration): array
|
||||
{
|
||||
if (!isset($configuration['fields'])) {
|
||||
|
|
|
@ -33,10 +33,6 @@ class Service
|
|||
*/
|
||||
protected $objectManager;
|
||||
|
||||
/**
|
||||
* Service constructor.
|
||||
* @param ObjectManagerInterface $objectManager
|
||||
*/
|
||||
public function __construct(ObjectManagerInterface $objectManager)
|
||||
{
|
||||
$this->objectManager = $objectManager;
|
||||
|
@ -46,9 +42,6 @@ class Service
|
|||
* Executes the dataprocessor depending on configuration and returns the result.
|
||||
*
|
||||
* @param array|string $configuration Either the full configuration or only the class name.
|
||||
* @param array $data
|
||||
* @param string $recordType
|
||||
* @return array
|
||||
*/
|
||||
public function executeDataProcessor($configuration, array $data, string $recordType = ''): array
|
||||
{
|
||||
|
|
|
@ -41,11 +41,6 @@ class TcaRelationResolvingProcessor implements ProcessorInterface
|
|||
*/
|
||||
protected $relationResolver;
|
||||
|
||||
/**
|
||||
* TcaRelationResolvingProcessor constructor.
|
||||
* @param ObjectManagerInterface $objectManager
|
||||
* @param RelationResolver $relationResolver
|
||||
*/
|
||||
public function __construct(
|
||||
ObjectManagerInterface $objectManager,
|
||||
RelationResolver $relationResolver
|
||||
|
@ -55,9 +50,6 @@ class TcaRelationResolvingProcessor implements ProcessorInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException If _table is not configured.
|
||||
*/
|
||||
public function processData(array $record, array $configuration): array
|
||||
|
@ -79,7 +71,6 @@ class TcaRelationResolvingProcessor implements ProcessorInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $configuration
|
||||
* @throws \InvalidArgumentException If _table is not configured.
|
||||
*/
|
||||
protected function initializeConfiguration(array &$configuration)
|
||||
|
@ -95,11 +86,6 @@ class TcaRelationResolvingProcessor implements ProcessorInterface
|
|||
$configuration['excludeFields'] = GeneralUtility::trimExplode(',', $configuration['excludeFields'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @param array $configuration
|
||||
* @return array
|
||||
*/
|
||||
protected function getRecordToProcess(array $record, array $configuration): array
|
||||
{
|
||||
if ($configuration['excludeFields'] === []) {
|
||||
|
|
|
@ -33,28 +33,17 @@ class Join
|
|||
*/
|
||||
protected $condition = '';
|
||||
|
||||
/**
|
||||
* Join constructor.
|
||||
* @param string $table
|
||||
* @param string $condition
|
||||
*/
|
||||
public function __construct(string $table, string $condition)
|
||||
{
|
||||
$this->table = $table;
|
||||
$this->condition = $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTable(): string
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCondition(): string
|
||||
{
|
||||
return $this->condition;
|
||||
|
|
|
@ -33,28 +33,17 @@ class Where
|
|||
*/
|
||||
protected $parameters = [];
|
||||
|
||||
/**
|
||||
* Where constructor.
|
||||
* @param string $statement
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function __construct(string $statement, array $parameters)
|
||||
{
|
||||
$this->statement = $statement;
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatement(): string
|
||||
{
|
||||
return $this->statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters(): array
|
||||
{
|
||||
return $this->parameters;
|
||||
|
|
|
@ -65,20 +65,12 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$this->logger = $logManager->getLogger(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* AbstractIndexer constructor.
|
||||
* @param ConnectionInterface $connection
|
||||
* @param ConfigurationContainerInterface $configuration
|
||||
*/
|
||||
public function __construct(ConnectionInterface $connection, ConfigurationContainerInterface $configuration)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function indexAllDocuments()
|
||||
{
|
||||
$this->logger->info('Start indexing');
|
||||
|
@ -97,10 +89,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$this->logger->info('Finish indexing');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return void
|
||||
*/
|
||||
public function indexDocument(string $identifier)
|
||||
{
|
||||
$this->logger->info('Start indexing single record.', [$identifier]);
|
||||
|
@ -116,9 +104,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$this->logger->info('Finish indexing');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$this->logger->info('Start deletion of index.');
|
||||
|
@ -126,9 +111,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$this->logger->info('Finish deletion.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function deleteDocuments()
|
||||
{
|
||||
$this->logger->info('Start deletion of indexed documents.');
|
||||
|
@ -142,26 +124,17 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$this->logger->info('Finish deletion.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator
|
||||
*/
|
||||
protected function getRecordGenerator(): \Generator
|
||||
{
|
||||
$offset = 0;
|
||||
$limit = $this->getLimit();
|
||||
|
||||
while (($records = $this->getRecords($offset, $limit)) !== null) {
|
||||
if (!empty($records)) {
|
||||
while (($records = $this->getRecords($offset, $limit)) !== []) {
|
||||
yield $records;
|
||||
}
|
||||
$offset += $limit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareRecord(array &$record)
|
||||
{
|
||||
try {
|
||||
|
@ -175,10 +148,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$this->handleAbstract($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @return void
|
||||
*/
|
||||
protected function generateSearchIdentifiers(array &$record)
|
||||
{
|
||||
if (!isset($record['search_document'])) {
|
||||
|
@ -189,10 +158,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @return void
|
||||
*/
|
||||
protected function handleAbstract(array &$record)
|
||||
{
|
||||
$record['search_abstract'] = '';
|
||||
|
@ -219,8 +184,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
|
||||
/**
|
||||
* Returns the limit to use to fetch records.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
protected function getLimit(): int
|
||||
{
|
||||
|
@ -238,27 +201,14 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param integer $limit
|
||||
* @return array|null
|
||||
*/
|
||||
abstract protected function getRecords(int $offset, int $limit);
|
||||
abstract protected function getRecords(int $offset, int $limit): array;
|
||||
|
||||
/**
|
||||
* @param integer $identifier
|
||||
* @return array
|
||||
* @throws NoRecordFoundException If record could not be found.
|
||||
*/
|
||||
abstract protected function getRecord(int $identifier): array;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getDocumentName(): string;
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getDocumentIdentifier($identifier): string;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,6 @@ class IndexerFactory implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return IndexerInterface
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
public function getIndexer(string $identifier): IndexerInterface
|
||||
|
@ -73,9 +71,6 @@ class IndexerFactory implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $indexerClass
|
||||
* @param string $identifier
|
||||
* @return IndexerInterface
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
protected function buildIndexer(string $indexerClass, string $identifier): IndexerInterface
|
||||
|
|
|
@ -28,45 +28,31 @@ interface IndexerInterface
|
|||
{
|
||||
/**
|
||||
* Fetches all documents from the indexerService and pushes it to the connection.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAllDocuments();
|
||||
|
||||
/**
|
||||
* Fetches a single document and pushes it to the connection.
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return void
|
||||
*/
|
||||
public function indexDocument(string $identifier);
|
||||
|
||||
/**
|
||||
* Delete the whole index.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete();
|
||||
|
||||
/**
|
||||
* Delete the whole index.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteDocuments();
|
||||
|
||||
/**
|
||||
* Receives the identifier of the indexer itself.
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return void
|
||||
*/
|
||||
public function setIdentifier(string $identifier);
|
||||
|
||||
/**
|
||||
* Returnes the identifier of the indexer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifier(): string;
|
||||
}
|
||||
|
|
|
@ -49,16 +49,11 @@ class TcaIndexer extends AbstractIndexer
|
|||
$this->tcaTableService = $tcaTableService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param integer $limit
|
||||
* @return array|null
|
||||
*/
|
||||
protected function getRecords(int $offset, int $limit)
|
||||
protected function getRecords(int $offset, int $limit): array
|
||||
{
|
||||
$records = $this->tcaTableService->getRecords($offset, $limit);
|
||||
if ($records === []) {
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->tcaTableService->filterRecordsByRootLineBlacklist($records);
|
||||
|
@ -70,8 +65,6 @@ class TcaIndexer extends AbstractIndexer
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $identifier
|
||||
* @return array
|
||||
* @throws NoRecordFoundException If record could not be found.
|
||||
*/
|
||||
protected function getRecord(int $identifier): array
|
||||
|
@ -88,18 +81,11 @@ class TcaIndexer extends AbstractIndexer
|
|||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getDocumentName(): string
|
||||
{
|
||||
return $this->tcaTableService->getTableName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function getDocumentIdentifier($identifier): string
|
||||
{
|
||||
return $this->getDocumentName() . '-' . $identifier;
|
||||
|
|
|
@ -60,9 +60,6 @@ class PagesIndexer extends TcaIndexer
|
|||
$this->contentTableService = $contentTableService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
*/
|
||||
protected function prepareRecord(array &$record)
|
||||
{
|
||||
parent::prepareRecord($record);
|
||||
|
@ -86,10 +83,6 @@ class PagesIndexer extends TcaIndexer
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $uid
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchContentForPage(int $uid): array
|
||||
{
|
||||
if ($this->contentTableService instanceof TcaTableService) {
|
||||
|
@ -135,29 +128,16 @@ class PagesIndexer extends TcaIndexer
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $uidOfContentElement
|
||||
* @return array
|
||||
*/
|
||||
protected function getContentElementImages(int $uidOfContentElement): array
|
||||
{
|
||||
return $this->fetchSysFileReferenceUids($uidOfContentElement, 'tt_content', 'image');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $uid
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchMediaForPage(int $uid): array
|
||||
{
|
||||
return $this->fetchSysFileReferenceUids($uid, 'pages', 'media');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $uid
|
||||
* @param array $pageAccess
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchAccess(int $uid, array $pageAccess): array
|
||||
{
|
||||
try {
|
||||
|
@ -194,12 +174,6 @@ class PagesIndexer extends TcaIndexer
|
|||
return array_values($access);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $uid
|
||||
* @param string $tablename
|
||||
* @param string $fieldname
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchSysFileReferenceUids(int $uid, string $tablename, string $fieldname): array
|
||||
{
|
||||
$imageRelationUids = [];
|
||||
|
@ -212,10 +186,6 @@ class PagesIndexer extends TcaIndexer
|
|||
return $imageRelationUids;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $contentElement
|
||||
* @return string
|
||||
*/
|
||||
protected function getContentFromContentElement(array $contentElement): string
|
||||
{
|
||||
$content = '';
|
||||
|
|
|
@ -34,11 +34,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|||
*/
|
||||
class RelationResolver implements Singleton
|
||||
{
|
||||
/**
|
||||
* @param TcaTableServiceInterface $service
|
||||
* @param array $record
|
||||
* @return array
|
||||
*/
|
||||
public function resolveRelationsForRecord(TcaTableServiceInterface $service, array $record): array
|
||||
{
|
||||
foreach (array_keys($record) as $column) {
|
||||
|
@ -64,11 +59,6 @@ class RelationResolver implements Singleton
|
|||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param array $tcaColumn
|
||||
* @return array
|
||||
*/
|
||||
protected function resolveValue($value, array $tcaColumn)
|
||||
{
|
||||
if ($value === '' || $value === 'N/A') {
|
||||
|
@ -85,10 +75,6 @@ class RelationResolver implements Singleton
|
|||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isRelation(array &$config): bool
|
||||
{
|
||||
return isset($config['foreign_table'])
|
||||
|
@ -96,27 +82,16 @@ class RelationResolver implements Singleton
|
|||
|| (isset($config['internal_type']) && strtolower($config['internal_type']) === 'db');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return array
|
||||
*/
|
||||
protected function resolveForeignDbValue(string $value): array
|
||||
{
|
||||
return array_map('trim', explode(';', $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return array
|
||||
*/
|
||||
protected function resolveInlineValue(string $value): array
|
||||
{
|
||||
return array_map('trim', explode(',', $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getUtilityForMode(): string
|
||||
{
|
||||
if (TYPO3_MODE === 'BE') {
|
||||
|
@ -126,12 +101,6 @@ class RelationResolver implements Singleton
|
|||
return FrontendUtility::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @param string $column
|
||||
* @param TcaTableServiceInterface $service
|
||||
* @return string
|
||||
*/
|
||||
protected function getColumnValue(array $record, string $column, TcaTableServiceInterface $service): string
|
||||
{
|
||||
$utility = GeneralUtility::makeInstance($this->getUtilityForMode());
|
||||
|
|
|
@ -83,8 +83,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $tableName
|
||||
* @param ConfigurationContainerInterface $configuration
|
||||
* @throws IndexingException
|
||||
*/
|
||||
public function __construct(
|
||||
|
@ -103,27 +101,16 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
$this->configuration = $configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTableName(): string
|
||||
{
|
||||
return $this->tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTableClause(): string
|
||||
{
|
||||
return $this->tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param integer $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getRecords(int $offset, int $limit): array
|
||||
{
|
||||
$records = $this->getQuery()
|
||||
|
@ -135,10 +122,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $records ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $identifier
|
||||
* @return array
|
||||
*/
|
||||
public function getRecord(int $identifier): array
|
||||
{
|
||||
$query = $this->getQuery();
|
||||
|
@ -148,10 +131,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $record ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $records
|
||||
* @return void
|
||||
*/
|
||||
public function filterRecordsByRootLineBlacklist(array &$records)
|
||||
{
|
||||
$records = array_filter(
|
||||
|
@ -162,10 +141,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @return void
|
||||
*/
|
||||
public function prepareRecord(array &$record)
|
||||
{
|
||||
if (isset($record[$this->tca['ctrl']['label']]) && !isset($record['search_title'])) {
|
||||
|
@ -203,9 +178,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Where
|
||||
*/
|
||||
protected function getWhereClause(): Where
|
||||
{
|
||||
$parameters = [];
|
||||
|
@ -228,9 +200,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return new Where($whereClause, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getFields(): array
|
||||
{
|
||||
$fields = array_merge(
|
||||
|
@ -253,10 +222,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getJoins(): array
|
||||
{
|
||||
if ($this->tableName === 'pages') {
|
||||
|
@ -287,10 +252,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $whereClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $columnName
|
||||
* @return bool
|
||||
*/
|
||||
protected function isSystemField(string $columnName): bool
|
||||
{
|
||||
$systemFields = [
|
||||
|
@ -317,8 +278,7 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $columnName
|
||||
* @return bool
|
||||
* @throws InvalidArgumentException If column does not exist.
|
||||
*/
|
||||
protected function isUserField(string $columnName): bool
|
||||
{
|
||||
|
@ -327,8 +287,7 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $columnName
|
||||
* @return bool
|
||||
* @throws InvalidArgumentException If column does not exist.
|
||||
*/
|
||||
protected function isPassthroughField(string $columnName): bool
|
||||
{
|
||||
|
@ -337,8 +296,7 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $columnName
|
||||
* @return array
|
||||
* @throws InvalidArgumentException If column does not exist.
|
||||
*/
|
||||
public function getColumnConfig(string $columnName): array
|
||||
{
|
||||
|
@ -352,9 +310,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $this->tca['columns'][$columnName]['config'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguageUidColumn(): string
|
||||
{
|
||||
if (!isset($this->tca['ctrl']['languageField'])) {
|
||||
|
@ -371,9 +326,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
* Also further TYPO3 mechanics are taken into account. Does a valid root
|
||||
* line exist, is page inside a recycler, is inherited start- endtime
|
||||
* excluded, etc.
|
||||
*
|
||||
* @param array $record
|
||||
* @return bool
|
||||
*/
|
||||
protected function isRecordBlacklistedByRootline(array &$record): bool
|
||||
{
|
||||
|
@ -432,7 +384,7 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
*/
|
||||
protected function isBlackListedRootLineConfigured(): bool
|
||||
{
|
||||
return (bool)$this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist');
|
||||
return $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -448,9 +400,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return QueryBuilder
|
||||
*/
|
||||
public function getQuery(): QueryBuilder
|
||||
{
|
||||
$queryBuilder = $this->getDatabaseConnection()->getQueryBuilderForTable($this->getTableName());
|
||||
|
@ -468,9 +417,6 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ConnectionPool
|
||||
*/
|
||||
protected function getDatabaseConnection(): ConnectionPool
|
||||
{
|
||||
return GeneralUtility::makeInstance(ConnectionPool::class);
|
||||
|
|
|
@ -35,38 +35,16 @@ interface TcaTableServiceInterface
|
|||
|
||||
/**
|
||||
* Filter the given records by root line blacklist settings.
|
||||
* @param array $records
|
||||
* @return void
|
||||
*/
|
||||
public function filterRecordsByRootLineBlacklist(array &$records);
|
||||
|
||||
/**
|
||||
* @param array $record
|
||||
* @return mixed
|
||||
*/
|
||||
public function prepareRecord(array &$record);
|
||||
|
||||
/**
|
||||
* @param string $columnName
|
||||
* @return array
|
||||
*/
|
||||
public function getColumnConfig(string $columnName): array;
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @param integer $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getRecords(int $offset, int $limit): array;
|
||||
|
||||
/**
|
||||
* @param integer $identifier
|
||||
* @return array
|
||||
*/
|
||||
public function getRecord(int $identifier): array;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguageUidColumn(): string;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,6 @@ class FacetRequest implements FacetRequestInterface
|
|||
/**
|
||||
* As the facets come from configuration this might be a good idea to help
|
||||
* integrators find issues.
|
||||
* @param string $identifier
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(string $identifier, array $config)
|
||||
{
|
||||
|
@ -47,17 +45,11 @@ class FacetRequest implements FacetRequestInterface
|
|||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifier(): string
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig(): array
|
||||
{
|
||||
return $this->config;
|
||||
|
|
|
@ -46,8 +46,6 @@ trait QueryResultInterfaceStub
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $offset
|
||||
* @return boolean
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
|
@ -57,7 +55,6 @@ trait QueryResultInterfaceStub
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $offset
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
|
@ -66,8 +63,6 @@ trait QueryResultInterfaceStub
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $offset
|
||||
* @param $value
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
|
@ -76,7 +71,6 @@ trait QueryResultInterfaceStub
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $offset
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
|
|
|
@ -35,54 +35,33 @@ class ResultItem implements ResultItemInterface
|
|||
*/
|
||||
protected $type = '';
|
||||
|
||||
/**
|
||||
* ResultItem constructor.
|
||||
* @param array $result
|
||||
* @param string $type
|
||||
*/
|
||||
public function __construct(array $result, string $type)
|
||||
{
|
||||
$this->data = $result;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPlainData(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->data[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->data[$offset];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
|
@ -91,7 +70,6 @@ class ResultItem implements ResultItemInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
|
|
|
@ -81,42 +81,27 @@ class SearchRequest implements SearchRequestInterface
|
|||
$this->query = $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getQuery(): string
|
||||
{
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSearchTerm(): string
|
||||
{
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $filter
|
||||
*/
|
||||
public function setFilter(array $filter)
|
||||
{
|
||||
$filter = ArrayUtility::removeArrayEntryByValue($filter, '');
|
||||
$this->filter = CustomArrayUtility::removeEmptyElementsRecursively($filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasFilter(): bool
|
||||
{
|
||||
return count($this->filter) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFilter(): array
|
||||
{
|
||||
return $this->filter;
|
||||
|
@ -124,8 +109,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
|
||||
/**
|
||||
* Add a facet to gather in this search request.
|
||||
*
|
||||
* @param FacetRequestInterface $facet
|
||||
*/
|
||||
public function addFacet(FacetRequestInterface $facet)
|
||||
{
|
||||
|
@ -143,17 +126,12 @@ class SearchRequest implements SearchRequestInterface
|
|||
/**
|
||||
* Define connection to use for this request.
|
||||
* Necessary to allow implementation of execute for interface.
|
||||
*
|
||||
* @param ConnectionInterface $connection
|
||||
*/
|
||||
public function setConnection(ConnectionInterface $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchService $searchService
|
||||
*/
|
||||
public function setSearchService(SearchService $searchService)
|
||||
{
|
||||
$this->searchService = $searchService;
|
||||
|
@ -163,8 +141,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
// Current implementation covers only paginate widget support.
|
||||
|
||||
/**
|
||||
* @param bool $returnRawQueryResult
|
||||
* @return SearchResultInterface
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function execute($returnRawQueryResult = false)
|
||||
|
@ -185,10 +161,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
return $this->searchService->processResult($this->connection->search($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $limit
|
||||
* @return $this
|
||||
*/
|
||||
public function setLimit($limit)
|
||||
{
|
||||
$this->limit = (int)$limit;
|
||||
|
@ -196,10 +168,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $offset
|
||||
* @return $this
|
||||
*/
|
||||
public function setOffset($offset)
|
||||
{
|
||||
$this->offset = (int)$offset;
|
||||
|
@ -207,17 +175,11 @@ class SearchRequest implements SearchRequestInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getLimit()
|
||||
{
|
||||
return $this->limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getOffset()
|
||||
{
|
||||
return $this->offset;
|
||||
|
@ -232,7 +194,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $orderings
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function setOrderings(array $orderings)
|
||||
|
@ -241,7 +202,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function matching($constraint)
|
||||
|
@ -250,7 +210,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $constraint1
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function logicalAnd($constraint1)
|
||||
|
@ -259,7 +218,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $constraint1
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function logicalOr($constraint1)
|
||||
|
@ -268,7 +226,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function logicalNot(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint)
|
||||
|
@ -277,9 +234,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @param bool $caseSensitive
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function equals($propertyName, $operand, $caseSensitive = true)
|
||||
|
@ -288,9 +242,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param string $operand
|
||||
* @param bool $caseSensitive
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function like($propertyName, $operand, $caseSensitive = true)
|
||||
|
@ -299,8 +250,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function contains($propertyName, $operand)
|
||||
|
@ -309,8 +258,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function in($propertyName, $operand)
|
||||
|
@ -319,8 +266,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function lessThan($propertyName, $operand)
|
||||
|
@ -329,8 +274,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function lessThanOrEqual($propertyName, $operand)
|
||||
|
@ -339,8 +282,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function greaterThan($propertyName, $operand)
|
||||
|
@ -349,8 +290,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @param mixed $operand
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function greaterThanOrEqual($propertyName, $operand)
|
||||
|
@ -367,7 +306,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function setQuerySettings(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings)
|
||||
|
@ -408,7 +346,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $propertyName
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function isEmpty($propertyName)
|
||||
|
@ -417,7 +354,6 @@ class SearchRequest implements SearchRequestInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function setSource(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source)
|
||||
|
|
|
@ -53,11 +53,6 @@ class SearchResult implements SearchResultInterface
|
|||
*/
|
||||
protected $position = 0;
|
||||
|
||||
/**
|
||||
* SearchResult constructor.
|
||||
* @param SearchResultInterface $originalSearchResult
|
||||
* @param array $resultItems
|
||||
*/
|
||||
public function __construct(SearchResultInterface $originalSearchResult, array $resultItems)
|
||||
{
|
||||
$this->originalSearchResult = $originalSearchResult;
|
||||
|
@ -74,9 +69,6 @@ class SearchResult implements SearchResultInterface
|
|||
return $this->results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function initResults()
|
||||
{
|
||||
if (is_array($this->results)) {
|
||||
|
@ -89,41 +81,26 @@ class SearchResult implements SearchResultInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFacets(): array
|
||||
{
|
||||
return $this->originalSearchResult->getFacets();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurrentCount(): int
|
||||
{
|
||||
return $this->originalSearchResult->getCurrentCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return $this->originalSearchResult->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->getResults()[$this->position];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
++$this->position;
|
||||
|
@ -131,33 +108,21 @@ class SearchResult implements SearchResultInterface
|
|||
return $this->current();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer|mixed
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return isset($this->getResults()[$this->position]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
|
||||
*/
|
||||
public function getQuery()
|
||||
{
|
||||
return $this->originalSearchResult->getQuery();
|
||||
|
|
|
@ -41,18 +41,11 @@ class CachedSearchService implements SingletonInterface
|
|||
*/
|
||||
protected $searchService;
|
||||
|
||||
/**
|
||||
* @param SearchService $searchService
|
||||
*/
|
||||
public function __construct(SearchService $searchService)
|
||||
{
|
||||
$this->searchService = $searchService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return SearchResultInterface
|
||||
*/
|
||||
public function search(SearchRequestInterface $searchRequest): SearchResultInterface
|
||||
{
|
||||
$hash = $this->getHash($searchRequest);
|
||||
|
@ -62,10 +55,6 @@ class CachedSearchService implements SingletonInterface
|
|||
return $this->results[$hash] = $this->searchService->search($searchRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return string
|
||||
*/
|
||||
protected function getHash(SearchRequestInterface $searchRequest): string
|
||||
{
|
||||
if (is_callable([$searchRequest, 'getRequestHash'])) {
|
||||
|
|
|
@ -45,12 +45,6 @@ class QueryFactory
|
|||
*/
|
||||
protected $configurationUtility;
|
||||
|
||||
/**
|
||||
* QueryFactory constructor.
|
||||
* @param \TYPO3\CMS\Core\Log\LogManager $logManager
|
||||
* @param ConfigurationContainerInterface $configuration
|
||||
* @param ConfigurationUtility $configurationUtility
|
||||
*/
|
||||
public function __construct(
|
||||
\TYPO3\CMS\Core\Log\LogManager $logManager,
|
||||
ConfigurationContainerInterface $configuration,
|
||||
|
@ -65,19 +59,12 @@ class QueryFactory
|
|||
* TODO: This is not in scope Elasticsearch, therefore it should not return
|
||||
* \Elastica\Query, but decide to use a more specific QueryFactory like
|
||||
* ElasticaQueryFactory, once the second query is added?
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return \Elastica\Query
|
||||
*/
|
||||
public function create(SearchRequestInterface $searchRequest): \Elastica\Query
|
||||
{
|
||||
return $this->createElasticaQuery($searchRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return \Elastica\Query
|
||||
*/
|
||||
protected function createElasticaQuery(SearchRequestInterface $searchRequest): \Elastica\Query
|
||||
{
|
||||
$query = [];
|
||||
|
@ -97,10 +84,6 @@ class QueryFactory
|
|||
return new \Elastica\Query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
*/
|
||||
protected function addSize(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
ArrayUtility::mergeRecursiveWithOverrule($query, [
|
||||
|
@ -109,10 +92,6 @@ class QueryFactory
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
*/
|
||||
protected function addSearch(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
if (trim($searchRequest->getSearchTerm()) === '') {
|
||||
|
@ -145,10 +124,6 @@ class QueryFactory
|
|||
$query = ArrayUtility::setValueByPath($query, 'query.bool.must.0.multi_match', $matchExpression, '.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
*/
|
||||
protected function addBoosts(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
try {
|
||||
|
@ -185,10 +160,6 @@ class QueryFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $query
|
||||
* @return void
|
||||
*/
|
||||
protected function addFactorBoost(array &$query)
|
||||
{
|
||||
try {
|
||||
|
@ -203,11 +174,6 @@ class QueryFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
* @return void
|
||||
*/
|
||||
protected function addFields(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
try {
|
||||
|
@ -237,11 +203,6 @@ class QueryFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
* @return void
|
||||
*/
|
||||
protected function addSort(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
$sorting = $this->configuration->getIfExists('searching.sort') ?: [];
|
||||
|
@ -252,11 +213,6 @@ class QueryFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
* @return void
|
||||
*/
|
||||
protected function addFilters(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
if (!$searchRequest->hasFilter()) {
|
||||
|
@ -273,13 +229,6 @@ class QueryFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param array $config
|
||||
* @param array $query
|
||||
* @return array
|
||||
*/
|
||||
protected function addFilter(string $name, $value, array $config, array &$query): array
|
||||
{
|
||||
if (!empty($config)) {
|
||||
|
@ -329,11 +278,6 @@ class QueryFactory
|
|||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @param array $query
|
||||
* @return void
|
||||
*/
|
||||
protected function addFacets(SearchRequestInterface $searchRequest, array &$query)
|
||||
{
|
||||
foreach ($searchRequest->getFacets() as $facet) {
|
||||
|
|
|
@ -75,10 +75,6 @@ class SearchService
|
|||
$this->dataProcessorService = $dataProcessorService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
* @return SearchResultInterface
|
||||
*/
|
||||
public function search(SearchRequestInterface $searchRequest): SearchResultInterface
|
||||
{
|
||||
$this->addSize($searchRequest);
|
||||
|
@ -94,8 +90,6 @@ class SearchService
|
|||
|
||||
/**
|
||||
* Add configured size of search result items to request.
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
*/
|
||||
protected function addSize(SearchRequestInterface $searchRequest)
|
||||
{
|
||||
|
@ -106,8 +100,6 @@ class SearchService
|
|||
|
||||
/**
|
||||
* Add facets from configuration to request.
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
*/
|
||||
protected function addConfiguredFacets(SearchRequestInterface $searchRequest)
|
||||
{
|
||||
|
@ -127,8 +119,6 @@ class SearchService
|
|||
|
||||
/**
|
||||
* Add filters from configuration, e.g. flexform or TypoScript.
|
||||
*
|
||||
* @param SearchRequestInterface $searchRequest
|
||||
*/
|
||||
protected function addConfiguredFilters(SearchRequestInterface $searchRequest)
|
||||
{
|
||||
|
@ -148,9 +138,6 @@ class SearchService
|
|||
|
||||
/**
|
||||
* Processes the result, e.g. applies configured data processing to result.
|
||||
*
|
||||
* @param SearchResultInterface $searchResult
|
||||
* @return SearchResultInterface
|
||||
*/
|
||||
public function processResult(SearchResultInterface $searchResult): SearchResultInterface
|
||||
{
|
||||
|
|
|
@ -73,11 +73,6 @@ class DataHandler implements Singleton
|
|||
$this->logger = $logManager->getLogger(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* DataHandler constructor.
|
||||
* @param ConfigurationContainerInterface $configuration
|
||||
* @param IndexerFactory $indexerFactory
|
||||
*/
|
||||
public function __construct(ConfigurationContainerInterface $configuration, IndexerFactory $indexerFactory)
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
|
@ -85,9 +80,6 @@ class DataHandler implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param array $record
|
||||
* @return void
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
public function update(string $table, array $record)
|
||||
|
@ -96,11 +88,6 @@ class DataHandler implements Singleton
|
|||
$this->getIndexer($table)->indexDocument($record['uid']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $identifier
|
||||
* @return void
|
||||
*/
|
||||
public function delete(string $table, string $identifier)
|
||||
{
|
||||
$this->logger->debug('Record received for delete.', [$table, $identifier]);
|
||||
|
@ -108,8 +95,6 @@ class DataHandler implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @return IndexerInterface
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
protected function getIndexer(string $table): IndexerInterface
|
||||
|
@ -117,10 +102,6 @@ class DataHandler implements Singleton
|
|||
return $this->indexerFactory->getIndexer($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @return boolean
|
||||
*/
|
||||
public function supportsTable(string $table): bool
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -50,8 +50,6 @@ class DataHandler implements Singleton
|
|||
/**
|
||||
* Dependency injection as TYPO3 doesn't provide it on it's own.
|
||||
* Still you can submit your own dataHandler.
|
||||
* @param OwnDataHandler $dataHandler
|
||||
* @param Logger $logger
|
||||
*/
|
||||
public function __construct(OwnDataHandler $dataHandler = null, Logger $logger = null)
|
||||
{
|
||||
|
@ -75,10 +73,6 @@ class DataHandler implements Singleton
|
|||
|
||||
/**
|
||||
* Called by CoreDataHandler on deletion of records.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $uid
|
||||
* @return bool
|
||||
*/
|
||||
public function processCmdmap_deleteAction(string $table, string $uid): bool
|
||||
{
|
||||
|
@ -92,8 +86,6 @@ class DataHandler implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param CoreDataHandler $dataHandler
|
||||
* @return void
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
public function processDatamap_afterAllOperations(CoreDataHandler $dataHandler)
|
||||
|
@ -117,9 +109,6 @@ class DataHandler implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
* @param CoreDataHandler $dataHandler
|
||||
* @return void
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
public function clearCachePostProc(array $parameters, CoreDataHandler $dataHandler)
|
||||
|
@ -141,9 +130,6 @@ class DataHandler implements Singleton
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param integer $uid
|
||||
* @return bool
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
protected function processRecord(string $table, int $uid): bool
|
||||
|
@ -163,10 +149,6 @@ class DataHandler implements Singleton
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldProcessHookForTable(string $table): bool
|
||||
{
|
||||
if ($this->dataHandler === null) {
|
||||
|
@ -184,8 +166,6 @@ class DataHandler implements Singleton
|
|||
/**
|
||||
* Wrapper to allow unit testing.
|
||||
*
|
||||
* @param string $table
|
||||
* @param integer $uid
|
||||
* @return array|null
|
||||
*/
|
||||
protected function getRecord(string $table, int $uid)
|
||||
|
|
|
@ -38,10 +38,6 @@ class FrontendUserAccessFilter
|
|||
$this->appendQueryWithAccessFilter($parameters['query'], $parameters['value']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $query
|
||||
* @param string $field
|
||||
*/
|
||||
protected function appendQueryWithAccessFilter(array &$query, string $field)
|
||||
{
|
||||
$query['query']['bool']['must'][] = [
|
||||
|
@ -49,9 +45,6 @@ class FrontendUserAccessFilter
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getUserGroups(): array
|
||||
{
|
||||
$feUser = $this->getFrontendUserAuthentication();
|
||||
|
@ -72,10 +65,7 @@ class FrontendUserAccessFilter
|
|||
return [0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FrontendUserAuthentication
|
||||
*/
|
||||
protected function getFrontendUserAuthentication()
|
||||
protected function getFrontendUserAuthentication(): FrontendUserAuthentication
|
||||
{
|
||||
return $GLOBALS['TSFE']->fe_user ?? null;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ class DataHandlerFinisher extends AbstractFinisher
|
|||
];
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws FinisherException
|
||||
* @throws NoMatchingIndexerException
|
||||
*/
|
||||
|
|
|
@ -8,12 +8,9 @@ namespace Codappix\SearchCore\Utility;
|
|||
*/
|
||||
class ArrayUtility
|
||||
{
|
||||
|
||||
/**
|
||||
* Recursively removes empty array elements.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array the modified array
|
||||
* @see \TYPO3\CMS\Extbase\Utility\ArrayUtility::removeEmptyElementsRecursively Removed in TYPO3 v9
|
||||
*/
|
||||
public static function removeEmptyElementsRecursively(array $array): array
|
||||
|
|
|
@ -30,9 +30,6 @@ use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
|||
*/
|
||||
class FrontendUtility extends BackendUtility
|
||||
{
|
||||
/**
|
||||
* @return TypoScriptFrontendController
|
||||
*/
|
||||
protected static function getLanguageService(): TypoScriptFrontendController
|
||||
{
|
||||
return $GLOBALS['TSFE'];
|
||||
|
|
Loading…
Reference in a new issue