diff --git a/README.md b/README.md index 0a890ad3..371da652 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,7 @@ We'd love your contributions! If you want to contribute please read our [Contrib * [@axnetg](https://github.com/axnetg) * [@abbottdev](https://github.com/abbottdev) * [@PrudiusVladislav](https://github.com/PrudiusVladislav) +* [@CormacLennon](https://github.com/CormacLennon) [Logo]: images/logo.svg diff --git a/src/Redis.OM/Searching/RedisQueryProvider.cs b/src/Redis.OM/Searching/RedisQueryProvider.cs index 1feb8219..c98c1577 100644 --- a/src/Redis.OM/Searching/RedisQueryProvider.cs +++ b/src/Redis.OM/Searching/RedisQueryProvider.cs @@ -84,7 +84,11 @@ public IQueryable CreateQuery(Expression expression) (IQueryable)Activator.CreateInstance( typeof(RedisCollection<>).MakeGenericType(elementType), this, - expression); + expression, + StateManager, + null, + _saveState, + _chunkSize); } catch (TargetInvocationException e) { @@ -102,7 +106,7 @@ public IQueryable CreateQuery(Expression expression) where TElement : notnull { var booleanExpression = expression as Expression>; - return new RedisCollection(this, expression, StateManager, booleanExpression, true); + return new RedisCollection(this, expression, StateManager, booleanExpression, _saveState, _chunkSize); } /// diff --git a/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs b/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs index 9d2bce21..ca203819 100644 --- a/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs +++ b/test/Redis.OM.Unit.Tests/RediSearchTests/SearchTests.cs @@ -3822,5 +3822,22 @@ public async Task EnumerateAllButAllExpired() Assert.Empty(people); } + + [Fact] + public void TestBasicQueryCastToIQueryable() + { + _substitute.ClearSubstitute(); + _substitute.Execute(Arg.Any(), Arg.Any()).Returns(_mockReply); + var y = 33; + var collection = new RedisCollection(_substitute, 1234) as IQueryable; + _ = collection.Where(x => x.Age < y).ToList(); + _substitute.Received().Execute( + "FT.SEARCH", + "person-idx", + "(@Age:[-inf (33])", + "LIMIT", + "0", + "1234"); + } } } \ No newline at end of file