From dead4b5db76c3c51883d64fb561d259cc90e13ea Mon Sep 17 00:00:00 2001 From: Sleeps Date: Thu, 8 Oct 2026 10:30:48 +0100 Subject: [PATCH] Prioritise precise caption matches in mixed Jellyfin search --- .../Jellyfin.Plugin.SceneSearch/SceneSearchProvider.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/SceneSearchProvider.cs b/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/SceneSearchProvider.cs index e038207..bff438e 100644 --- a/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/SceneSearchProvider.cs +++ b/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/SceneSearchProvider.cs @@ -18,6 +18,11 @@ public sealed class SceneSearchProvider : IExternalSearchProvider // modifying or forking the other provider. private const float ExplicitSceneScoreFloor = 1.1f; private const float ExplicitSceneScoreRange = 0.9f; + // Small boost for at most two exact caption-text matches returned by the + // backend. This prevents a full page of ordinary Meilisearch results from + // pushing all caption matches beyond Jellyfin's result cap. + private const float CaptionTextScoreFloor = 1.01f; + private const float CaptionTextScoreRange = 0.05f; private static readonly HashSet SupportedKinds = [ @@ -124,6 +129,10 @@ public sealed class SceneSearchProvider : IExternalSearchProvider { score = ExplicitSceneScoreFloor + (ExplicitSceneScoreRange * score); } + else if (result.CaptionTextMatch) + { + score = CaptionTextScoreFloor + (CaptionTextScoreRange * score); + } yielded++; yield return new SearchResult(itemId, score);