Search and related schemas


#1

Hi, this request is for our self-hosted Squidex solution with MongoDB in Atlas.

We have a schema A with references to schema B, C and D. The B,C,D schemas are lookup tables and some are localized. They mainly contain a single text string.

Schema A will only contain GUIDS as references to the other schemas, and the B,C,D VALUES are not added to the schema A search index field.

How can we search within schema A and return entities matching lookup values from the related schemas?

Right now we’re considering adding a tag field to schema A like e.g. “searchindex” and re-index by a microservice every night. This service will get all data from the B,C,D schemas and add the values from these in the tag field.

Do any of you know a better way to support searching related schemas?

*We have to use the rest apis and can’t use GraphQL queries.


#2

It is so irritating to have users without avatars :wink:

But thank you for asking the question in the forum again. The chat (drift) is not the right place for support, because other users can hopefully profit from this discussion as well.

In general Squidex has a NoSQL concept for data modeling. Not only because it is based on MongoDB but also because of my personal experience with data modeling.

In general you have two options:

  1. Multiple queries
  2. Denormalization.

I think your microservice approach sounds like a good idea. You can also increase the consistency with webhooks and update the contents whenever you update or create an entity.

I would also ask the question to myself if you really need the other schemas. If you only have few entries like shoe sizes or so than it might be easier to just use a string field with a dropdown editor.