Skip to content

Commit 96728ee

Browse files
committed
Regenerate text embeddings when web content is updated [LAB-18]
1 parent af80ce7 commit 96728ee

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

app/Console/Commands/Import/ImportWebFull.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,25 @@ protected function query($endpoint, $page = 1, $limit = 10)
125125

126126
return parent::query($endpoint, $page, $limit);
127127
}
128+
129+
/**
130+
* If an artwork was updated, and if the primary image was updated, reimport the
131+
* image embeddings.
132+
*
133+
* @param \Illuminate\Database\Eloquent\Model
134+
* @return \Illuminate\Database\Eloquent\Model
135+
*/
136+
protected function afterSave($resource)
137+
{
138+
if (in_array(get_class($resource), [
139+
\App\Models\Web\Article::class,
140+
\App\Models\Web\Highlight::class,
141+
\App\Models\Web\LandingPage::class,
142+
\App\Models\Web\DigitalPublicationArticle::class,
143+
\App\Models\Web\PrintedPublication::class,
144+
])) {
145+
$this->generateAndSaveWebEmbeddngs($resource, $this);
146+
}
147+
return $resource;
148+
}
128149
}

0 commit comments

Comments
 (0)