Skip to content
Snippets Groups Projects
Commit 2388f7da authored by Markus Kalkbrenner's avatar Markus Kalkbrenner
Browse files

fixed limit of index IDs in new drush commands

parent b78bbf72
No related branches found
No related tags found
No related merge requests found
Pipeline #519540 failed
......@@ -179,7 +179,7 @@ class SearchApiSolrCommands extends DrushCommands implements StdinAwareInterface
#[Usage(name: 'drush search-api-solr:finalize-index node_index', description: 'Finalize the index with the ID node_index.')]
#[Usage(name: 'drush search-api-solr:finalize-index node_index --force', description: 'Index a maximum number of 100 items for the index with the ID node_index.')]
public function finalizeIndex(?string $indexId = NULL, bool $force = FALSE): void {
$this->commandHelper->finalizeIndexCommand($indexId ? [$indexId] : $indexId, $force);
$this->commandHelper->finalizeIndexCommand($indexId ? [$indexId] : NULL, $force);
$this->logger()->success('Solr %index_id finalized.', ['%index_id' => $indexId]);
}
......@@ -285,7 +285,7 @@ class SearchApiSolrCommands extends DrushCommands implements StdinAwareInterface
?int $threads = 3,
?int $batchSize = -999, // @todo Real default is NULL.
): void {
$ids = $this->commandHelper->indexParallelCommand([$indexId], $threads, -999 === $batchSize ? NULL : $batchSize);
$ids = $this->commandHelper->indexParallelCommand($indexId ? [$indexId] : NULL, $threads, -999 === $batchSize ? NULL : $batchSize);
$processes = [];
$siteAlias = $this->siteAliasManager()->getSelf();
......
......@@ -124,6 +124,9 @@ class SolrCommandHelper extends CommandHelper {
* @throws \Drupal\search_api_solr\SearchApiSolrException
*/
public function finalizeIndexCommand(?array $indexIds = NULL, $force = FALSE) {
if ($indexIds === [NULL]) {
$indexIds = NULL;
}
$servers = search_api_solr_get_servers();
if ($force) {
......@@ -209,6 +212,9 @@ class SolrCommandHelper extends CommandHelper {
* Thrown if one of the affected indexes had an invalid tracker set.
*/
public function indexParallelCommand(?array $indexIds = NULL, $threads = 2, $batchSize = NULL): array {
if ($indexIds === [NULL]) {
$indexIds = NULL;
}
$indexes = $this->loadIndexes($indexIds);
if (!$indexes) {
return [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment