apply sonar suggestions

This commit is contained in:
TOomaAh 2026-06-21 18:46:12 +02:00
parent 42b480bd21
commit 5bf90f90ff
4 changed files with 6 additions and 28 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Text;
namespace Jellyfin.Database.Providers.Sqlite.Extensions;
@ -32,15 +33,8 @@ public static class Fts5QueryBuilder
var result = new StringBuilder(searchTerm.Length * 2);
var firstWord = true;
foreach (var word in words)
foreach (var cleanWord in words.Select(CleanWord).Where(w => !string.IsNullOrWhiteSpace(w)))
{
var cleanWord = CleanWord(word);
if (string.IsNullOrWhiteSpace(cleanWord))
{
continue;
}
if (!firstWord)
{
result.Append(' ');
@ -58,12 +52,9 @@ public static class Fts5QueryBuilder
{
var cleaned = new StringBuilder(word.Length);
foreach (var c in word)
foreach (var c in word.Where(c => char.IsLetterOrDigit(c) || c == '-' || c == '_' || c == '\'' || c == '.'))
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '_' || c == '\'' || c == '.')
{
cleaned.Append(c);
}
cleaned.Append(c);
}
return cleaned.ToString();

View file

@ -1,13 +0,0 @@
namespace Jellyfin.Database.Providers.Sqlite.Extensions;
/// <summary>
/// Custom EF Core database functions for SQLite FTS5 operations.
/// These methods are mapped to SQL functions and should never be called directly in C# code.
/// </summary>
/// <remarks>
/// Currently empty as FTS implementation uses direct 'WHERE IN' approach with BaseItemFtsEntity.
/// This class is kept for potential future custom FTS functions.
/// </remarks>
public static class SqliteFtsDbFunctions
{
}

View file

@ -19,7 +19,7 @@ namespace Jellyfin.Database.Providers.Sqlite.Migrations
return new SqliteJellyfinDbContext(
optionsBuilder.Options,
NullLogger<JellyfinDbContext>.Instance,
NullLogger<SqliteJellyfinDbContext>.Instance,
new SqliteDatabaseProvider(null!, NullLogger<SqliteDatabaseProvider>.Instance),
new NoLockBehavior(NullLogger<NoLockBehavior>.Instance));
}

View file

@ -16,7 +16,7 @@ namespace Jellyfin.Database.Providers.Sqlite;
/// <param name="entityFrameworkCoreLocking">The locking behavior.</param>
public class SqliteJellyfinDbContext(
DbContextOptions options,
ILogger<JellyfinDbContext> logger,
ILogger<SqliteJellyfinDbContext> logger,
IJellyfinDatabaseProvider jellyfinDatabaseProvider,
IEntityFrameworkCoreLockingBehavior entityFrameworkCoreLocking)
: JellyfinDbContext(options, logger, jellyfinDatabaseProvider, entityFrameworkCoreLocking)