Skip to content

Commit

Permalink
NEW Add support for comma separated ids in ReindexItemJob
Browse files Browse the repository at this point in the history
This allows manual creation of multiple index jobs via the CMS jobs
interface (i.e 1,2,3) to publish all 3 pages
  • Loading branch information
wilr committed Aug 3, 2021
1 parent 12d10a0 commit b6f1fe4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Jobs/AlgoliaIndexItemJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($itemClass = null, $itemIds = null)

if ($itemIds) {
if (!is_array($itemIds)) {
$this->itemIds = [$itemIds];
$this->itemIds = explode(',', $itemIds);
} else {
$this->itemIds = $itemIds;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ public function process()
unset($obj);
}

$this->remainingChildren = $remainingChildren;
$this->remainingIds = $remainingChildren;

if (!count($remainingChildren)) {
$this->isComplete = true;
Expand Down
15 changes: 9 additions & 6 deletions src/Service/AlgoliaQuerier.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ function array_key_first(array $arr)
}
}

$output = PaginatedList::create($records)
->setCurrentPage($results['page'] + 1)
->setTotalItems($results['nbHits'])
->setLimitItems(false)
->setPageStart($results['page'] * $results['hitsPerPage'])
->setPageLength($results['hitsPerPage']);
$output = PaginatedList::create($records);

if ($results) {
$output = $output->setCurrentPage($results['page'] + 1)
->setTotalItems($results['nbHits'])
->setLimitItems(false)
->setPageStart($results['page'] * $results['hitsPerPage'])
->setPageLength($results['hitsPerPage']);
}

return $output;
}
Expand Down

0 comments on commit b6f1fe4

Please sign in to comment.