You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A month a go we added the missing NQL features (e.g. relations, mongo json utility etc.). This is what you have to know:
Aliases are now called: expansions. We no longer use the wording aliases. The reason is that there are two requirements for replacing stuff in a filter:
replace a key name e.g. filter=tags:x -> {tags.slug:x}
expand a statement if a key name matches e.g. filter:primary_tag:de -> {$and: [{tags.slug:de}, {sort_order:0}]} (optional)
That means, the expansions feature is more than just a simple string replacement. It can expand the mongo JSON query.
When the merge json utility logic was moved over from Ghost to NQL, i noticed that we no longer use nql-lang to replace the aliases/expansions. The expansion logic does it now.
Why?
All string filters are parsed by nql-lang as first step. And afterwards we pass the parsed filters into the utility. As soon as a key matches the configured expansions, the expansion logic replaces the key in the mongo json object and adds/extends the expansion filter to the target statement
Background
nql-lang introduced aliases support mid of 2018. nql-lang is able to replace keys in a filter string.
State of NQL 0.2.1
A month a go we added the missing NQL features (e.g. relations, mongo json utility etc.). This is what you have to know:
Aliases are now called: expansions. We no longer use the wording aliases. The reason is that there are two requirements for replacing stuff in a filter:
filter=tags:x
->{tags.slug:x}
filter:primary_tag:de
->{$and: [{tags.slug:de}, {sort_order:0}]}
(optional)That means, the expansions feature is more than just a simple string replacement. It can expand the mongo JSON query.
When the merge json utility logic was moved over from Ghost to NQL, i noticed that we no longer use nql-lang to replace the aliases/expansions. The expansion logic does it now.
Why?
All string filters are parsed by nql-lang as first step. And afterwards we pass the parsed filters into the utility. As soon as a key matches the configured expansions, the expansion logic replaces the key in the mongo json object and adds/extends the expansion filter to the target statement
e.g.
filter=tags:bla+primary_tag:blub
should be
filter=tags.slug:bla+(tags.slug:blub+posts_tags.sort_order:0)
If nql-lang would replace the name independently of the expanded filter, we first would get:
{$and: [tags.slug:bla, tags.slug:blub]}
Now you don't know which part you need to expand?
Discussion/Research
We have not spend further time on this. Is it possible to use nql-lang again?
This needs a bit playing & thinking.
The text was updated successfully, but these errors were encountered: