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

[BUG] Reindexing options -l and -b work not with -c (or long versions) or -a #1215

Open
BFallert opened this issue May 28, 2024 · 0 comments
Labels
🐛 bug A non-security related bug.

Comments

@BFallert
Copy link
Collaborator

Description

Problem

At the moment it is not possible to reindex a large collection with -l (--index-limit) and -b (--index-begin). It is only possible to reindex the whole dataset.
If the reindexing options -l (--index-limit) and -b (--index-begin) are used, a simultaneously specified parameter -c (--coll) is ignored.
If -a (--all) is used together with the parameters -l (--index-limit) and -b (--index-begin), these two parameters are ignored.

Proposed Solution

It should also be possible to reindex a large collection using -l and -b. If the current behavior is desired, the documentation would have to be adapted.

Additional Context

if (!empty($input->getOption('all'))) {
// Get all documents.
$documents = $this->documentRepository->findAll();
} elseif (
!empty($input->getOption('index-limit'))
&& $input->getOption('index-begin') >= 0
) {
// Get all documents for given limit and start.
$documents = $this->documentRepository->findAll()
->getQuery()
->setLimit((int) $input->getOption('index-limit'))
->setOffset((int) $input->getOption('index-begin'))
->execute();
$io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.');
} elseif (
!empty($input->getOption('coll'))
&& !is_array($input->getOption('coll'))
) {
// "coll" may be a single integer or a comma-separated list of integers.
if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), true)))) {
$io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.');
return BaseCommand::FAILURE;
}
// Get all documents of given collections.
$documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), true), 0);
} else {
$io->error('ERROR: One of parameters --all|-a or --coll|-c must be given.');
return BaseCommand::FAILURE;
}

@sebastian-meyer sebastian-meyer changed the title Reindexing options -l and -b work not with -c (or long versions) or -a [BUG] Reindexing options -l and -b work not with -c (or long versions) or -a May 28, 2024
@sebastian-meyer sebastian-meyer added the 🐛 bug A non-security related bug. label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug A non-security related bug.
Projects
None yet
Development

No branches or pull requests

2 participants