diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs
index 69285d96d..4cfd84d2e 100644
--- a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs
+++ b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.Designer.cs
@@ -843,6 +843,15 @@ namespace Squidex.Domain.Apps.Core {
}
}
+ ///
+ /// Looks up a localized string similar to The collation or language code that should be used to compare strings, e.g. for sorting..
+ ///
+ public static string QueryCollation {
+ get {
+ return ResourceManager.GetString("QueryCollation", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Optional OData filter..
///
@@ -879,6 +888,15 @@ namespace Squidex.Domain.Apps.Core {
}
}
+ ///
+ /// Looks up a localized string similar to Picks N random of elements from the schema..
+ ///
+ public static string QueryRandom {
+ get {
+ return ResourceManager.GetString("QueryRandom", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Optional OData full text search..
///
diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx
index 244ff2e51..9df238aa6 100644
--- a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx
+++ b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptions.resx
@@ -378,6 +378,9 @@
The current operation.
+
+ The collation or language code that should be used to compare strings, e.g. for sorting.
+
Optional OData filter.
@@ -390,6 +393,9 @@
JSON query as well formatted json string. Overrides all other query parameters, except 'ids'.
+
+ Picks N random of elements from the schema.
+
Optional OData full text search.
diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs
index 07fbf78c4..94eb3390e 100644
--- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs
+++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs
@@ -86,6 +86,13 @@ public static class Extensions
public static async Task> QueryContentsAsync(this IMongoCollection collection, FilterDefinition filter, ClrQuery query, Q q,
CancellationToken ct)
{
+ Collation? collation = null;
+
+ if (query.Collation != null)
+ {
+ collation = new Collation(query.Collation);
+ }
+
if (query.Skip > 0 && !query.IsSatisfiedByIndex())
{
// If we have to skip over items, we could reach the limit of the sort buffer, therefore get the ids and all filter fields only
@@ -97,10 +104,15 @@ public static class Extensions
projection = projection.Include(field);
}
+ var aggregateOptions = new AggregateOptions
+ {
+ Collation = collation,
+ };
+
if (query.Random > 0)
{
var ids =
- await collection.Aggregate()
+ await collection.Aggregate(aggregateOptions)
.Match(filter)
.Project(projection)
.QuerySort(query)
@@ -118,7 +130,7 @@ public static class Extensions
}
var joined =
- await collection.Aggregate()
+ await collection.Aggregate(aggregateOptions)
.Match(filter)
.Project(projection)
.QuerySort(query)
@@ -138,8 +150,13 @@ public static class Extensions
return joined.Select(x => x.Joined[0]).ToList();
}
+ var findOptions = new FindOptions
+ {
+ Collation = collation,
+ };
+
var result =
- collection.Find(filter)
+ collection.Find(filter, findOptions)
.QuerySort(query)
.QuerySkip(query)
.QueryLimit(query)
diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs
index d63bd7a5a..9282428eb 100644
--- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs
+++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentActions.cs
@@ -185,6 +185,18 @@ internal static class ContentActions
Description = FieldDescriptions.QuerySearch,
DefaultValue = null
},
+ new QueryArgument(Scalars.String)
+ {
+ Name = "collation",
+ Description = FieldDescriptions.QueryCollation,
+ DefaultValue = null
+ },
+ new QueryArgument(Scalars.Int)
+ {
+ Name = "random",
+ Description = FieldDescriptions.QueryRandom,
+ DefaultValue = null
+ },
];
public static readonly IFieldResolver Query = Resolvers.Async