-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Replace GQL with NQL (filter plugin) #10105
Comments
Started with this task. It's very important to get rid of |
refs TryGhost#10105 - `options.where` is an older deprecated logic - before the filter language was invented, Ghost generates statements for knex - if we want to replace GQL with NQL, we can't generate these statements - they are not understood from NQL, because NQL uses mongo JSON - go through usages and rewrite the statements - invent `extraFilters` for now - we need to keep the support for `status` or `staticPages` for now (API requirement)
Just analysed this custom filter logic. - pre processed filter logic.
|
Looking at this piece. MeaningIs only used when using NQL?This is nothing NQL should handle, because NQL only applies queries based on the filter string. Ghost ?There is already a TODO.
The pagination plugin has a section to respect order definitions of the target model e.g.
|
refs TryGhost#10105 - ordering !== filtering
refs #10105 - ordering !== filtering
refs TryGhost#10105 - `options.where` is an older deprecated logic - before the filter language was invented, Ghost generates statements for knex - if we want to replace GQL with NQL, we can't generate these statements - they are not understood from NQL, because NQL uses mongo JSON - go through usages and rewrite the statements - invent `extraFilters` for now - we need to keep the support for `status` or `staticPages` for now (API requirement)
refs #10105 - `options.where` is an older deprecated logic - before the filter language was invented, Ghost generates statements for knex - if we want to replace GQL with NQL, we can't generate these statements - they are not understood from NQL, because NQL uses mongo JSON - go through usages and rewrite the statements - invent `extraFilters` for now - we need to keep the support for `status` or `staticPages` for now (API requirement) - IMO both shortcuts in the extra filters should be removed in the future This commit is required for #10159!
refs TryGhost#10105 - ordering !== filtering
refs TryGhost#10105 [ci skip]
refs TryGhost#10105 [ci skip]
refs TryGhost#10105 [ci skip]
refs #10105, closes #10108, closes #9950, refs #9923, refs #9916, refs #9574, refs #6345, refs #6309, refs #6158, refs TryGhost/GQL#16 - removed GQL dependency - replaced GQL with our brand new NQL implementation - fixed all known filter limitations - GQL suffered from some underlying filter bugs, which NQL tried to fix - the bugs were mostly in how we query the database for relation filtering - the underlying problem was caused by a too simple implementation of querying the relations - mongo-knex has implemented a more robust and complex filtering mechanism for relations - replaced logic in our bookshelf filter plugin - we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex. NQL: https://github.com/NexesJS/NQL mongo-knex: https://github.com/NexesJS/mongo-knex
FYI: 5 tasks are left, which are post cleanup tasks |
This was shipped in Ghost 2.8.0.. The post cleanup tasks are done. |
Goal
As soon as NQL is feature complete, we would like to replace GQL with NQL in the model layer. Ghost uses a filter plugin to hook into the database query.
Why?
GQL has a couple of bugs - especially with filtering on relations.
e.g. #9950
Strategy
The filter plugin is a little messy currently.
Ghost creates joins after GQL has finished. Ghost should not be responsible to create the joins. We should pass a proper configuration object to NQL and based on this information, NQL attaches the correct queries.
Ghost merges custom filters (from user), default and enforced filters. We need to keep this logic. NQL has to offer an interface.
The filter plugin needs to be touched if we want to replace GQL.
Tasks
options.where
GQL statements with filter notation #10160)posts_tags.sort_order=0
with NQL (Filter by multiple relation columns mongo-knex#14)yg
grouping cases on nql-lang (https://github.com/NexesJS/NQL-Lang/issues/7)Ghost: master
The text was updated successfully, but these errors were encountered: