From 26f3bf8d6a71b1171f1f76a0c83658b19f0bee0d Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 1 May 2024 03:45:51 +0200 Subject: [PATCH] Fixed title tag filtering in manticore scene sync. --- src/update-search.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/update-search.js b/src/update-search.js index 67bc2946..5d7ee296 100644 --- a/src/update-search.js +++ b/src/update-search.js @@ -70,7 +70,7 @@ async function updateManticoreSceneSearch(releaseIds) { parents.slug as network_slug, parents.name as network_name, COALESCE(JSON_AGG(DISTINCT (actors.id, actors.name)) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors, - COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name, tags.priority)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags, + COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name, tags.priority, tags_aliases.name)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags, COALESCE(JSON_AGG(DISTINCT (movies.id)) FILTER (WHERE movies.id IS NOT NULL), '[]') as movies, studios.showcased IS NOT false AND (entities.showcased IS NOT false OR COALESCE(studios.showcased, false) = true) @@ -115,8 +115,8 @@ async function updateManticoreSceneSearch(releaseIds) { const docs = scenes.rows.map((scene) => { const flatActors = scene.actors.flatMap((actor) => actor.f2.split(' ')); - const flatTags = scene.tags.filter((tag) => tag.f3 > 6).flatMap((tag) => tag.f2.split(' ')); // only make top tags searchable to minimize cluttered results - const filteredTitle = scene.title && [...flatActors, ...flatTags].reduce((accTitle, tag) => accTitle.replace(new RegExp(tag.replace(/[^\w\s]+/g, ''), 'i'), ''), scene.title).trim().replace(/\s{2,}/, ' '); + const flatTags = scene.tags.filter((tag) => tag.f3 > 6).flatMap((tag) => [tag.f2].concat(tag.f4)).filter(Boolean); // only make top tags searchable to minimize cluttered results + const filteredTitle = scene.title && [...flatActors, ...flatTags].reduce((accTitle, tag) => accTitle.replace(new RegExp(`\\b${tag.replace(/[^\w\s]+/g, '')}\\b`, 'gi'), ''), scene.title).trim().replace(/\s{2,}/, ' '); return { replace: {