Skip to content

fix query translation on aggregation set when has punctuation marks o… #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private static string BuildEqualityPredicate(MemberInfo member, ConstantExpressi
switch (searchFieldType)
{
case SearchFieldType.TAG:
sb.Append($"{{{expression.Value}}}");
sb.Append($"{{{ExpressionParserUtilities.EscapeTagField(expression.Value.ToString())}}}");
break;
case SearchFieldType.TEXT:
sb.Append(expression.Value);
Expand Down
6 changes: 3 additions & 3 deletions src/Redis.OM/Redis.OM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<RootNamespace>Redis.OM</RootNamespace>
<Nullable>enable</Nullable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PackageVersion>0.5.2</PackageVersion>
<Version>0.5.2</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.5.2</PackageReleaseNotes>
<PackageVersion>0.5.3</PackageVersion>
<Version>0.5.3</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.5.3</PackageReleaseNotes>
<Description>Object Mapping and More for Redis</Description>
<Title>Redis OM</Title>
<Authors>Steve Lorello</Authors>
Expand Down
16 changes: 16 additions & 0 deletions test/Redis.OM.Unit.Tests/RediSearchTests/AggregationSetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,5 +539,21 @@ public void LeftBinExpressionWithUniaryOperator()
_ = collection.Where(query).ToList();
_mock.Verify(x => x.Execute("FT.AGGREGATE", "person-idx", "( @Age:[2 2] | @Age:[50 50] ) (@Name:Steve)", "WITHCURSOR", "COUNT", "10000"));
}
[Fact]
public void PunctuationMarkInTagQuery()
{
var customerFilter = new CustomerFilterDto()
{
FirstName = "Walter-Junior",
LastName = "White"
};
var collection = new RedisAggregationSet<Person>(_mock.Object, true, chunkSize: 10000);
_mock.Setup(x => x.Execute("FT.AGGREGATE", It.IsAny<string[]>())).Returns(MockedResult);
_mock.Setup(x => x.Execute("FT.CURSOR", It.IsAny<string[]>())).Returns(MockedResultCursorEnd);
Expression<Func<AggregationResult<Person>, bool>> query = a => a.RecordShell.FirstName == customerFilter.FirstName;
_ = collection.Where(query).ToList();
_mock.Verify(x => x.Execute("FT.AGGREGATE", "person-idx", "@FirstName:{Walter\\-Junior}", "WITHCURSOR", "COUNT", "10000"));
}

}
}