Skip to content
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

fix filter aggregation for string type on the right side #328

Merged
merged 5 commits into from
Mar 9, 2023
Merged

fix filter aggregation for string type on the right side #328

merged 5 commits into from
Mar 9, 2023

Conversation

imansafari1991
Copy link
Contributor

I try to use the filter on the aggregation as follows:

// Format Customer Full Names
            customerAggregations= customerAggregations.Apply(x => string.Format("{0} {1}", x.RecordShell.FirstName, x.RecordShell.LastName),
                "FullName");
            // Filter Customer whose full name is "Bruce Wayne"
            var filteredCustomers =
                customerAggregations.Filter(p => p.Aggregations["FullName"] == "Bruce Wayne").ToList();

But I've got an exception :

System.Exception: 'Syntax error at offset 19 near 'Wayne'
Failed on FT.AGGREGATE customer-idx * APPLY format("%s %s",@FirstName,@LastName) AS FullName FILTER @FullName == Bruce Wayne'

The translated query must add ' ' around the right-side expression. After more inspection, I found out p.Aggregations["FullName"] == "Bruce Wayne" is a unary expression and existing code, just add ' ' around the right-side when the left-side is a memberexpression.
Added a commit to solve.

Thanks.

Copy link
Member

@slorello89 slorello89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@slorello89 slorello89 merged commit e0adc1f into redis:main Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants