Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Support negation #41

Closed
wants to merge 7 commits into from
Closed

Conversation

bethanyr
Copy link

proposed solution to support different filtering around tags in ghost which supports many-to-many relationships. Some sample filters include: filter="tag:sports+tag:cats" and filter="tag:sports+tag:-cats"

Addresses: issue #16

Bethany Rentz added 2 commits May 16, 2018 10:49
…a post contains 1 or more tags and doesn't contain 1 or more tags
@bethanyr
Copy link
Author

I need to investigate why the tests are hanging

@ErisDS
Copy link
Member

ErisDS commented Jun 5, 2018

Hi @bethanyr apologies for the slow response here, and massive props for taking the time to work on GQL (not many people have delved in here 😬)

It's been two full years since GQL was implemented and it's served us well despite these crazy limitations around many-to-many relationships. I'm about to embark on a project to overcome all of those limitations and it's probably going to need a complete rewrite.

Gonna take a look at your approach this week to see where it gets us and whether we can use it to work around other limitations short of a rewrite.

I'm interested to know if you picked this issue up because you have a use case that currently isn't being met, or just for fun?

@bethanyr
Copy link
Author

bethanyr commented Jun 5, 2018

HI @ErisDS - thanks for taking a look at my approach - I know you are busy working on new features for ghost - which we are very interested in (ex: new editor and dynamic routing).

I ended up having to make some changes to our copy of ghost core to work with the gql changes I made (updating the config.channels.json for the tag route filter to: "filter": "tags:['%s']+tags.visibility:public" and updating tests in /integration/api/advanced_browse_spec.js) and I see that the beta for dynamic routing beta that was just released makes updates in this area so my solution might not be the best solution for Ghost.

We actually have some use cases that we are addressing with my change - and are using the changes I made in gql on our site as of today. We are using a customized version of ghost for foto.gettyimages.com - and our content publishers highly curate the home page and topic pages with which stories appear in each of the page sections - using internal tags. We would like to reduce the number of tags that editors need to apply to stories to determine where they appear - so being able to filter posts to show those that have both X tag and Y tag will be helpful. We also have a tag, #neverhighlight and in the case where we have published a story but for some reason we do not want it to be featured anywhere throughout the site - editors would like to apply that #neverhighlight tag, so we don't pull it in any of our post requests. Editors do not want to un-publish the story because it might already be linked to from social media or other sites and it doesn't need to be removed completely.

@ErisDS
Copy link
Member

ErisDS commented Jun 6, 2018

Quick answer to the most important point first:

I see that the beta for dynamic routing beta that was just released makes updates in this area so my solution might not be the best solution for Ghost.

The dynamic routing beta completely replaces the channels config beta, but dynamic routing is not yet feature-equivalent to channels. If you're using config.channels.json, please don't update Ghost your production Ghost to 1.24 just yet.

Will reply to the rest in a bit, wanted to leave that here :)

@ErisDS
Copy link
Member

ErisDS commented Dec 18, 2018

Hi @bethanyr, it took us a while, but we have rewritten GQL as https://github.com/nexesjs/NQL, which uses mongo json as the intermediary format, has the tool mongo-knex for building queries, and now supports negation correctly.

The work in this PR really helped to inform the approach we took, so thank you for the time you put into writing this.

@ErisDS ErisDS closed this Dec 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants