Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize index type #25

Merged
merged 1 commit into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Classes/Command/Index/UpdateFullCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ protected function configure()
{
$this
->setDescription('Process search indexers')
->addArgument('type', InputArgument::OPTIONAL, 'Type to run indexers for');
->addArgument('type', InputArgument::OPTIONAL, 'Type to run indexers for, all by default');
}

/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->indexingService->indexFull($input->getArgument('type'));
$this->indexingService->indexFull($input->getArgument('type') ?: '');

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/Command/Index/UpdatePartialCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ protected function configure()
{
$this
->setDescription('Process search indexer updates')
->addArgument('type', InputArgument::OPTIONAL, 'Type to run indexers for');
->addArgument('type', InputArgument::OPTIONAL, 'Type to run indexers for, all by default');
}

/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->indexingService->indexPartial($input->getArgument('type'));
$this->indexingService->indexPartial($input->getArgument('type') ?: '');

return 0;
}
Expand Down
14 changes: 7 additions & 7 deletions Classes/Service/IndexingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ public function injectLogManager(LogManager $logManager): void
protected $runFullIndexing = false;

/**
* Index type. If null, all indexers are run
* Index type. If empty, all indexers are run
*
* @var string|null
* @var string
*/
protected $type = null;
protected $type = '';

/**
* Sets up everything, needs to be run after installation.
Expand Down Expand Up @@ -179,7 +179,7 @@ public function resetIndex(int $language = null): void
*
* @param string $type If set, only runs indexing for the given type
*/
public function indexFull(string $type = null): void
public function indexFull(string $type = ''): void
{
$this->assertConnectionHealthy();

Expand All @@ -195,7 +195,7 @@ public function indexFull(string $type = null): void
*
* @param string $type If set, only runs indexing for the given type
*/
public function indexPartial(string $type = null): void
public function indexPartial(string $type = ''): void
{
$this->assertConnectionHealthy();

Expand All @@ -214,7 +214,7 @@ protected function collectScheduledIndexers(): void
$indices = ExtconfService::getIndices();

foreach ($indices as $language => $index) {
if ($this->type == null) {
if (empty($this->type)) {
foreach ($this->indexerFactory->makeIndexers($language) as $indexer) {
$this->scheduledIndexers[$language][] = $indexer;
}
Expand Down Expand Up @@ -258,7 +258,7 @@ protected function runIndexers(): void
}
}

if ($this->type === null) {
if (empty($this->type)) {
IndexManager::getInstance()->resetUpdateIndex();
$this->logger->info('Update index was reset');
} else {
Expand Down