diff --git a/Iceshrimp.Backend/Core/Extensions/QueryableFtsExtensions.cs b/Iceshrimp.Backend/Core/Extensions/QueryableFtsExtensions.cs index c4e2a192..29126efe 100644 --- a/Iceshrimp.Backend/Core/Extensions/QueryableFtsExtensions.cs +++ b/Iceshrimp.Backend/Core/Extensions/QueryableFtsExtensions.cs @@ -182,7 +182,7 @@ public static class QueryableFtsExtensions private static IQueryable ApplyRegularAttachmentFilter(this IQueryable query, AttachmentFilter filter) { - if (filter.Value.IsAny) + if (filter.Value.IsMedia) return query.Where(p => p.AttachedFileTypes.Count != 0); if (filter.Value.IsPoll) return query.Where(p => p.HasPoll); @@ -209,7 +209,7 @@ public static class QueryableFtsExtensions private static IQueryable ApplyNegatedAttachmentFilter(this IQueryable query, AttachmentFilter filter) { - if (filter.Value.IsAny) + if (filter.Value.IsMedia) return query.Where(p => p.AttachedFileTypes.Count == 0); if (filter.Value.IsPoll) return query.Where(p => !p.HasPoll); diff --git a/Iceshrimp.Parsing/SearchQuery.fs b/Iceshrimp.Parsing/SearchQuery.fs index 31a4a439..2f1aa32a 100644 --- a/Iceshrimp.Parsing/SearchQuery.fs +++ b/Iceshrimp.Parsing/SearchQuery.fs @@ -84,7 +84,7 @@ module SearchQueryFilters = type AttachmentFilterType = - | Any + | Media | Image | Video | Audio @@ -97,7 +97,8 @@ module SearchQueryFilters = member val Value = match value with - | "any" -> Any + | "any" -> Media + | "media" -> Media | "image" -> Image | "video" -> Video | "audio" -> Audio @@ -215,7 +216,7 @@ module private SearchQueryParser = <| fun n v -> InFilter(n.IsSome, v) :> Filter let attachmentFilter = - negKeyFilter [ "has"; "attachment"; "attached" ] [ "any"; "image"; "video"; "audio"; "file"; "poll" ] + negKeyFilter [ "has"; "attachment"; "attached" ] [ "any"; "media"; "image"; "video"; "audio"; "file"; "poll" ] <| fun n v -> AttachmentFilter(n.IsSome, v) :> Filter let afterFilter = diff --git a/Iceshrimp.Tests/Parsing/SearchQueryTests.cs b/Iceshrimp.Tests/Parsing/SearchQueryTests.cs index 09a25a21..c13a3193 100644 --- a/Iceshrimp.Tests/Parsing/SearchQueryTests.cs +++ b/Iceshrimp.Tests/Parsing/SearchQueryTests.cs @@ -98,12 +98,13 @@ public class SearchQueryTests { List keyCandidates = ["has", "attachment", "attached"]; if (negated) keyCandidates = keyCandidates.Select(p => "-" + p).ToList(); - List candidates = ["any", "image", "video", "audio", "file", "poll"]; + List candidates = ["any", "media", "image", "video", "audio", "file", "poll"]; var results = keyCandidates.Select(k => candidates.Select(v => $"{k}:{v}").SelectMany(SearchQuery.parse).ToList()); List expectedResults = [ new AttachmentFilter(negated, "any"), + new AttachmentFilter(negated, "media"), new AttachmentFilter(negated, "image"), new AttachmentFilter(negated, "video"), new AttachmentFilter(negated, "audio"),