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

Incorrect parse result for filters with outer/wrapped brackets #16

Closed
kirrg001 opened this issue Dec 12, 2018 · 0 comments · Fixed by #73
Closed

Incorrect parse result for filters with outer/wrapped brackets #16

kirrg001 opened this issue Dec 12, 2018 · 0 comments · Fixed by #73
Labels
bug Something isn't working

Comments

@kirrg001
Copy link
Contributor

NQL returns a wrong parsed result if filters are wrapped with outer brackets.

Let's assume you pass this filter: filter=featured:true,(tags:animal+tags:classic)

It results in:

{"$or":[{"featured":true},{"$and":[{"tags":"animal"},{"tags":"classic"}]}]}

Which is correct!

But if you pass a filter like this: filter=(tags:animal+tags:classic)

It results in:

{"yg":{"$and":[{"tags":"animal"},{"tags":"classic"}]}}

Which is wrong.


Reference: yg expression, see.

@kirrg001 kirrg001 added the bug Something isn't working label Dec 12, 2018
naz referenced this issue in naz/Ghost Jan 21, 2019
closes TryGhost#10395, TryGhost#10390

- The grouping was introduced due to a flasy conjunction of last filter in 'or' group with enforced page filter, due to this the rest of filters in the 'or' group were bypassed
- Additional grouping added here increases the possiblity of https://github.com/NexesJS/NQL-Lang/issues/7 bug happening
@daniellockyer daniellockyer transferred this issue from TryGhost/NQL-Lang Mar 1, 2022
mike182uk added a commit that referenced this issue Dec 7, 2023
refs [ARCH-24](https://linear.app/tryghost/issue/ARCH-24/fix-nql-incorrect-parse-result-for-filters-with-outerwrapped-brackets), fixes [#16](#16)

With this change, if `yg` is present in the output, it will be removed and
its contents will be moved to the parent node
mike182uk added a commit that referenced this issue Dec 7, 2023
fixes #16

With this change, if `yg` is present in the output, it will be removed and
its contents will be moved to the parent node
mike182uk added a commit that referenced this issue Jan 2, 2024
fixes #16

With this change, if `yg` is present in the output, it will be removed and
its contents will be moved to the parent node
mike182uk added a commit that referenced this issue Jan 3, 2024
…73)

fixes #16

With this change, if `yg` is present in the output, it will be removed and
its contents will be moved to the parent node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant