TryGhost / NQL

MIT License
4 stars 8 forks source link

Support for filtering empty and not empty relations #44

Open ErisDS opened 2 years ago

ErisDS commented 2 years ago

Problem

In Ghost we want to be able to filter posts that have tags, or do not have tags.

Solution

IMO the syntax should be filter=tags:null or filter=tags:-null.

This doesn't cause an error, but it also doesn't do what you'd expect.

filter=tags:null - should return all posts with no tags filter=tags:-null - should return all posts with at least one tag

Alternatively it could perhaps be done by supporting filtering on counts e.g.

filter=count.tags:0 filter=count.tags:>0

But this I think is a lot less intuitive.