mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 17:24:46 +03:00
Merge branch 'master' into minor
This commit is contained in:
@@ -2917,29 +2917,30 @@ namespace Emby.Server.Implementations.Data
|
||||
private string GetOrderByText(InternalItemsQuery query)
|
||||
{
|
||||
var orderBy = query.OrderBy;
|
||||
if (string.IsNullOrEmpty(query.SearchTerm))
|
||||
bool hasSimilar = query.SimilarTo != null;
|
||||
bool hasSearch = !string.IsNullOrEmpty(query.SearchTerm);
|
||||
|
||||
if (hasSimilar || hasSearch)
|
||||
{
|
||||
int oldLen = orderBy.Count;
|
||||
if (oldLen == 0 && query.SimilarTo != null)
|
||||
List<(string, SortOrder)> prepend = new List<(string, SortOrder)>(4);
|
||||
if (hasSearch)
|
||||
{
|
||||
var arr = new (string, SortOrder)[oldLen + 2];
|
||||
orderBy.CopyTo(arr, 0);
|
||||
arr[oldLen] = ("SimilarityScore", SortOrder.Descending);
|
||||
arr[oldLen + 1] = (ItemSortBy.Random, SortOrder.Ascending);
|
||||
query.OrderBy = arr;
|
||||
prepend.Add(("SearchScore", SortOrder.Descending));
|
||||
prepend.Add((ItemSortBy.SortName, SortOrder.Ascending));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
query.OrderBy = new[]
|
||||
|
||||
if (hasSimilar)
|
||||
{
|
||||
("SearchScore", SortOrder.Descending),
|
||||
(ItemSortBy.SortName, SortOrder.Ascending)
|
||||
};
|
||||
prepend.Add(("SimilarityScore", SortOrder.Descending));
|
||||
prepend.Add((ItemSortBy.Random, SortOrder.Ascending));
|
||||
}
|
||||
|
||||
var arr = new (string, SortOrder)[prepend.Count + orderBy.Count];
|
||||
prepend.CopyTo(arr, 0);
|
||||
orderBy.CopyTo(arr, prepend.Count);
|
||||
orderBy = query.OrderBy = arr;
|
||||
}
|
||||
|
||||
|
||||
if (orderBy.Count == 0)
|
||||
else if (orderBy.Count == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
@@ -6290,8 +6291,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
statement.TryBind("@Codec" + index, attachment.Codec);
|
||||
statement.TryBind("@CodecTag" + index, attachment.CodecTag);
|
||||
statement.TryBind("@Comment" + index, attachment.Comment);
|
||||
statement.TryBind("@FileName" + index, attachment.FileName);
|
||||
statement.TryBind("@MimeType" + index, attachment.MimeType);
|
||||
statement.TryBind("@Filename" + index, attachment.FileName);
|
||||
statement.TryBind("@MIMEType" + index, attachment.MimeType);
|
||||
}
|
||||
|
||||
statement.Reset();
|
||||
|
||||
Reference in New Issue
Block a user