TryGhost / NQL

MIT License
4 stars 8 forks source link

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

Closed kirrg001 closed 10 months ago

kirrg001 commented 5 years ago

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.