Skip to content

Commit

Permalink
Merge pull request #288 from qrazi/feat_backport_266_craft3
Browse files Browse the repository at this point in the history
feat: backport fix for #266 to Craft 3
  • Loading branch information
janhenckens committed Dec 27, 2023
2 parents 24f0cb9 + 3cf499c commit 43d2a65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Scout.php
Expand Up @@ -162,7 +162,10 @@ function (ElementEvent $event) {

if (Scout::$plugin->getSettings()->queue) {
Craft::$app->getQueue()->push(
new IndexElement(['id' => $element->id])
new IndexElement([
'id' => $element->id,
'siteId' => $element->site->id,
])
);
} else {
$element->searchable();
Expand Down
5 changes: 4 additions & 1 deletion src/jobs/IndexElement.php
Expand Up @@ -13,9 +13,12 @@ class IndexElement extends BaseJob
/** @var int */
public $id;

/** @var int */
public $siteId;

public function execute($queue)
{
$element = Craft::$app->getElements()->getElementById($this->id);
$element = Craft::$app->getElements()->getElementById($this->id, null, $this->siteId);

if (!$element) {
return;
Expand Down

0 comments on commit 43d2a65

Please sign in to comment.