Skip to content

Commit

Permalink
enhance verbose output of reindex cli job
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bigga committed Aug 2, 2019
1 parent 4f3b982 commit 1c7a625
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Classes/Command/IndexCommand.php
Expand Up @@ -123,10 +123,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$doc = Document::getInstance($input->getOption('doc'), $startingPoint, TRUE);
if ($doc->ready) {
if ($dryRun) {
$io->section('DRY RUN: Would index ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
$io->section('DRY RUN: Would index ' . $doc->uid . ' '. $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
} else {
if ($io->isVerbose()) {
$io->section('Will index ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
$io->section('Will index ' . $doc->uid . ' ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
}
// ...and save it to the database...
if (!$doc->save($startingPoint, $solrCoreUid)) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/Command/ReindexCommand.php
Expand Up @@ -132,14 +132,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$documents = $this->getDocumentsToProceed($input->getOption('coll'), $startingPoint);
}

foreach ($documents as $document) {
foreach ($documents as $id => $document) {
$doc = Document::getInstance($document, $startingPoint, TRUE);
if ($doc->ready) {
if ($dryRun) {
$io->writeln('DRY RUN: Would index ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
$io->writeln('DRY RUN: Would index ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
} else {
if ($io->isVerbose()) {
$io->writeln(date('Y-m-d H:m:s') . ' ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
$io->writeln(date('Y-m-d H:m:s') . ' ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ' . $doc->location . ' on UID ' . $startingPoint . ' and solr core ' . $solrCoreUid .'.');
}
// ...and save it to the database...
if (!$doc->save($startingPoint, $solrCoreUid)) {
Expand Down
9 changes: 9 additions & 0 deletions Documentation/User/Index.rst
Expand Up @@ -188,3 +188,12 @@ collections or even to reindex all documents on the given page.::
script may check the return value of the CLI job. This is always 0 on
success and 1 on failure.
:Example:

- :Option:
``-v|--verbose``
:Required:
no
:Description:
Show each processed documents uid and location with timestamp and
amount of processed/all documents.
:Example:

0 comments on commit 1c7a625

Please sign in to comment.