aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteveTheGrey <118358130+SteveTheGrey@users.noreply.github.com>2022-11-27 16:03:28 +0000
committerGitHub <noreply@github.com>2022-11-27 09:03:28 -0700
commit87d4ef7403f6601151397da977f4e591524c1709 (patch)
treebc83a2cdf54a7de1e3aa30e2bf1c813cb4694bcc
parent036382debbd61207799f17bffcd6379a4c1b3795 (diff)
Minor search update - full word titles matches first (#8757)
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs7
-rw-r--r--MediaBrowser.Model/Querying/ItemSortBy.cs5
2 files changed, 12 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 371111dff..4f0a15df1 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -2456,6 +2456,8 @@ namespace Emby.Server.Implementations.Data
builder.Append('(');
builder.Append("((CleanName like @SearchTermStartsWith or (OriginalTitle not null and OriginalTitle like @SearchTermStartsWith)) * 10)");
+ builder.Append("+ ((CleanName = @SearchTermStartsWith COLLATE NOCASE or (OriginalTitle not null and OriginalTitle = @SearchTermStartsWith COLLATE NOCASE)) * 10)");
+
if (query.SearchTerm.Length > 1)
{
@@ -3154,6 +3156,11 @@ namespace Emby.Server.Implementations.Data
return ItemSortBy.SimilarityScore;
}
+ if (string.Equals(name, ItemSortBy.SearchScore, StringComparison.OrdinalIgnoreCase))
+ {
+ return ItemSortBy.SearchScore;
+ }
+
// Unknown SortBy, just sort by the SortName.
return ItemSortBy.SortName;
}
diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.cs
index 470507c53..1a7c9a63b 100644
--- a/MediaBrowser.Model/Querying/ItemSortBy.cs
+++ b/MediaBrowser.Model/Querying/ItemSortBy.cs
@@ -154,5 +154,10 @@ namespace MediaBrowser.Model.Querying
/// The similarity score.
/// </summary>
public const string SimilarityScore = "SimilarityScore";
+
+ /// <summary>
+ /// The search score.
+ /// </summary>
+ public const string SearchScore = "SearchScore";
}
}