[IMPLEMENTED] Options to denormalize content generated from a normalised schema


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.


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


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).

I am working on this now:

The idea is that you can define referenced schemas on which you want to react in the content trigger.

In this example a hotel references a destination and in this case we trigger the action for all hotels, whenever a destination is changed.

This works only one one level and I am not sure, how to protect the system from unexpected load. Because this could trigger thousands of events.


This topic was automatically closed after 2 days. New replies are no longer allowed.