Update manticore search usage

This commit is contained in:
DariusIII
2026-08-02 22:49:50 +02:00
parent 7d3ad20c7b
commit afb06af625
38 changed files with 1133 additions and 224 deletions
+16 -5
View File
@@ -216,7 +216,7 @@ class Release extends Model
]
);
Search::updateRelease($parameters['id']);
self::syncSearchIndexAfterCommit((int) $parameters['id']);
return $parameters['id'];
}
@@ -249,7 +249,7 @@ class Release extends Model
]
);
Search::updateRelease($id);
self::syncSearchIndexAfterCommit((int) $id);
}
/**
@@ -262,7 +262,7 @@ class Release extends Model
$id = self::whereGuid($guid)->value('id');
self::whereGuid($guid)->increment('grabs');
if ($id !== null) {
Search::updateRelease((int) $id);
self::syncSearchIndexAfterCommit((int) $id);
}
}
}
@@ -284,7 +284,7 @@ class Release extends Model
$ids = self::query()->whereIn('guid', $guids)->pluck('id');
self::query()->whereIn('guid', $guids)->increment('grabs');
foreach ($ids as $id) {
Search::updateRelease((int) $id);
self::syncSearchIndexAfterCommit((int) $id);
}
}
}
@@ -302,7 +302,7 @@ class Release extends Model
$ids = self::whereVideosId($videoId)->pluck('id');
$updated = self::whereVideosId($videoId)->update(['videos_id' => 0, 'tv_episodes_id' => 0]);
foreach ($ids as $id) {
Search::updateRelease((int) $id);
self::syncSearchIndexAfterCommit((int) $id);
}
return $updated;
@@ -313,6 +313,17 @@ class Release extends Model
return self::whereAnidbid($anidbID)->update(['anidbid' => -1]);
}
private static function syncSearchIndexAfterCommit(int $releaseId): void
{
if ($releaseId <= 0) {
return;
}
DB::afterCommit(function () use ($releaseId): void {
Search::updateRelease($releaseId);
});
}
public static function getTopDownloads(): mixed
{
$expiresAt = now()->addMinutes(config('nntmux.cache_expiry_long'));