Options to denormalize content generated from a normalised schema

Hello,

I am looking at options to denormalize content generated from a normalised schema in squidex. For the users of a CMS it makes sense to provide a normalized view of schemas for them to be able to create content easily. for example any parent child relationship between content where common field values are defined at parent level.

Now, if I need to make this content available in a denormalized format where a single document in elastic search has all the fields to completely descript the child content ie. all the fields of the parent content as well as all the fields of the child content.

One option could be to create an API which does the denormalisation by fetching the content via squidex API and a rule to trigger for ContentChanged for both the schemas ? But that would require running an maintaining an extra API.

image

Not sure if this could be a generic use case that could be solved within squidex with any existing functionality ?

Thanks!

I would say it is called GraphQL and in Rules you can also fetch references.

Yes, I can configure rules on the child content and fetch references. But, when somethings changes on the parent content then I would want to be able to somehow Run the rule for all the referencing content ?

Yes, good point. But I am not sure how to implement that. It could end up in a cascade of thousands of updates.

Maybe something like a meta rule which triggers the rules of all the referencing content ? Just thinking out loud here.

This would be a major rebuild of the rule system because it triggers only on actual system events, something like “ContentChanged”

Does squidex support custom rules ? I could try out writing a custom rule which when configured to be triggered on system events would use the squidex api to fetch the references of the content its triggered for and trigger their rule using an api call

Yes, but you cannot trigger the rule, because it works on events. Same problem as described above. ou have to make the rule action manually.

I haven’t looked at the implementation of the General API but I found these endpoints:
GET /api/apps/{app}/rules
PUT /api/apps/{app}/rules/{id}/trigger
PUT /api/apps/{app}/rules/{id}/run

So assumed the rules could be triggered via API calls.

No, sorry

The second endpoint works for manual events only.
The third endpoint reruns the whole rule with all events from the past. you would republish all articles, not only the article where the author has changed (as an example).