diff --git a/back/src/Kyoo.Meilisearch/FilterExtensionMethods.cs b/back/src/Kyoo.Meilisearch/FilterExtensionMethods.cs index 50940668..de68b10d 100644 --- a/back/src/Kyoo.Meilisearch/FilterExtensionMethods.cs +++ b/back/src/Kyoo.Meilisearch/FilterExtensionMethods.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using Kyoo.Abstractions.Models.Utils; +using static System.Text.Json.JsonNamingPolicy; namespace Kyoo.Meiliseach; @@ -13,13 +14,13 @@ public static class FilterExtensionMethods => $"({and.First.CreateMeilisearchFilter()}) AND ({and.Second.CreateMeilisearchFilter()})", Filter.Or or => $"({or.First.CreateMeilisearchFilter()}) OR ({or.Second.CreateMeilisearchFilter()})", - Filter.Gt gt => $"{gt.Property} > {gt.Value}", - Filter.Lt lt => $"{lt.Property} < {lt.Value}", - Filter.Ge ge => $"{ge.Property} >= {ge.Value}", - Filter.Le le => $"{le.Property} <= {le.Value}", - Filter.Eq eq => $"{eq.Property} = {eq.Value}", - Filter.Has has => $"{has.Property} = {has.Value}", - Filter.Ne ne => $"{ne.Property} != {ne.Value}", + Filter.Gt gt => $"{CamelCase.ConvertName(gt.Property)} > '{gt.Value}'", + Filter.Lt lt => $"{CamelCase.ConvertName(lt.Property)} < '{lt.Value}'", + Filter.Ge ge => $"{CamelCase.ConvertName(ge.Property)} >= '{ge.Value}'", + Filter.Le le => $"{CamelCase.ConvertName(le.Property)} <= '{le.Value}'", + Filter.Eq eq => $"{CamelCase.ConvertName(eq.Property)} = '{eq.Value}'", + Filter.Has has => $"{CamelCase.ConvertName(has.Property)} = '{has.Value}'", + Filter.Ne ne => $"{CamelCase.ConvertName(ne.Property)} != '{ne.Value}'", Filter.Not not => $"NOT ({not.Filter.CreateMeilisearchFilter()})", Filter.CmpRandom => throw new ValidationException("Random comparison is not supported."),