Minor search update - full word titles matches first (#8757)

This commit is contained in:
SteveTheGrey 2022-11-27 16:03:28 +00:00 committed by GitHub
parent 036382debb
commit 87d4ef7403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -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;
}

View File

@ -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";
}
}