diff --git a/src/Redis.OM/Common/ExpressionParserUtilities.cs b/src/Redis.OM/Common/ExpressionParserUtilities.cs index f8e7623d..70aa492d 100644 --- a/src/Redis.OM/Common/ExpressionParserUtilities.cs +++ b/src/Redis.OM/Common/ExpressionParserUtilities.cs @@ -598,6 +598,13 @@ private static string TranslateContainsStandardQuerySyntax(MethodCallExpression { var propertyExpression = (MemberExpression)exp.Arguments.Last(); var valuesExpression = (MemberExpression)exp.Arguments.First(); + literal = GetOperandStringForQueryArgs(propertyExpression); + if (!literal.StartsWith("@")) + { + propertyExpression = (MemberExpression)exp.Arguments.First(); + valuesExpression = (MemberExpression)exp.Arguments.Last(); + } + var attribute = DetermineSearchAttribute(propertyExpression); if (attribute == null) { diff --git a/src/Redis.OM/Redis.OM.csproj b/src/Redis.OM/Redis.OM.csproj index 6208a7f0..2f24639a 100644 --- a/src/Redis.OM/Redis.OM.csproj +++ b/src/Redis.OM/Redis.OM.csproj @@ -6,9 +6,9 @@ Redis.OM enable true - 0.2.2 - 0.2.2 - https://github.com/redis/redis-om-dotnet/releases/tag/v0.2.2 + 0.2.3 + 0.2.3 + https://github.com/redis/redis-om-dotnet/releases/tag/v0.2.3 Object Mapping and More for Redis Redis OM Steve Lorello diff --git a/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs b/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs index 95b1094b..a186a315 100644 --- a/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs +++ b/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs @@ -2150,7 +2150,26 @@ public void SearchNumericFieldContains() "0", "100")); } - + + [Fact] + public void Issue201() + { + _mock.Setup(x => x.Execute(It.IsAny(), It.IsAny())) + .Returns(_mockReply); + + var p1 = new Person() {Name = "Steve"}; + var collection = new RedisCollection(_mock.Object, 1000); + collection.Where(x=>x.NickNames.Contains(p1.Name)).ToList(); + + _mock.Verify(x => x.Execute( + "FT.SEARCH", + "person-idx", + "(@NickNames:{Steve})", + "LIMIT", + "0", + "1000" + )); + } }