-
Notifications
You must be signed in to change notification settings - Fork 77
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
String extension method MatchContains throws System.InvalidOperationException: Unable to parse method MatchContains #481
Comments
@obradl, can you share your model and the code you are using? Or some minimal reproduction. I can't get this to happen on my end. |
I also get this error on MatchStartsWith and MatchEndsWith. Model:
The calling code:
StackTrace: |
@obradl - Using your model (I cleaned it up a bit because the syntax was off): [Document(StorageType = StorageType.Json, Prefixes = new[] {"House"}, Language = "norwegian")]
public class House
{
[RedisIdField]
[Indexed]
public required Ulid Id { get; set; }
[Searchable(Aggregatable = true, Sortable = true)]
public string Address { get; set; }
} I ran the following with Redis OM .NET 0.7.4: var muxer = ConnectionMultiplexer.Connect("localhost:6379");
var provider = new RedisConnectionProvider(muxer);
provider.Connection.DropIndexAndAssociatedRecords(typeof(House));
provider.Connection.CreateIndex(typeof(House));
var collection = provider.RedisCollection<House>();
var str = "wood";
await collection.Where(x => x.Address.MatchContains(str)).ToListAsync();
await collection.Where(x => x.Address.MatchStartsWith(str)).ToListAsync();
await collection.Where(x => x.Address.MatchEndsWith(str)).ToListAsync(); and could not replicate your issue, the correct query is created and sent. Can you send over a full, minimal reproduction that I can run and actually see it break? |
I observe that MatchContains works if it is the only operator in the query, so your example works fine for me as well. However, if I do something like this ( using MatchContains on both City and Address) it fails :
|
Hi,
I am trying to use the String extension method MatchContains in my Where clause on IRedisCollection.
This is my search where I want to perform an infix search:
redisCollection.Where(x => x.Address.MatchContains("road"));
- inspired by this testWhen I execute the query this exception appears:
System.InvalidOperationException: Unable to parse method MatchContains
The property on my model is of type string and marked with an Searchable attribute. I have also tried using the Indexed attribute but this also resulted in the same exception. A quick search in the git repo points me to the method TranslateMethodStandardQuerySyntax in ExpressionParserUtilities.cs
Versions:
Redis OM v. 0.7.4
RediSearch v. 2.8.13
RedisJson v. 2.6.10
The text was updated successfully, but these errors were encountered: