meilisearch search descr field configurable

This commit is contained in:
xiaomlove
2023-04-09 00:51:33 +08:00
parent fe49b6a2ba
commit 2c85edb1b3
13 changed files with 101 additions and 36 deletions

View File

@@ -703,34 +703,7 @@ HTML;
return $input;
}
public function removeDuplicateSnatch()
{
$size = 2000;
$stickyPromotionParticipatorsTable = 'sticky_promotion_participators';
$stickyPromotionExists = NexusDB::hasTable($stickyPromotionParticipatorsTable);
while (true) {
$snatchRes = NexusDB::select("select userid, torrentid, group_concat(id) as ids from snatched group by userid, torrentid having(count(*)) > 1 limit $size");
if (empty($snatchRes)) {
break;
}
do_log("[DELETE_DUPLICATED_SNATCH], count: " . count($snatchRes));
foreach ($snatchRes as $snatchRow) {
$torrentId = $snatchRow['torrentid'];
$userId = $snatchRow['userid'];
$idArr = explode(',', $snatchRow['ids']);
sort($idArr, SORT_NUMERIC);
$remainId = array_pop($idArr);
$delIdStr = implode(',', $idArr);
do_log("[DELETE_DUPLICATED_SNATCH], torrent: $torrentId, user: $userId, snatchIdStr: $delIdStr");
NexusDB::statement("delete from snatched where id in ($delIdStr)");
NexusDB::statement("update claims set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
NexusDB::statement("update hit_and_runs set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
if ($stickyPromotionExists) {
NexusDB::statement("update $stickyPromotionParticipatorsTable set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
}
}
}
}
public function getPaidIcon(array $torrentInfo, $size = 16, $verticalAlign = 'sub')
{