Record join possible?

Can we establish a relationship between two records?

For example:

Let’s say I have a record ArticleDetailsRecord which stores the content of an article and I need to refer these record in other two records, say Record_A and Record_B.

Record_A and Record_B contains only metadata where ArticleDetailsRecord has the original content.

If there are same contents in two articles we don’t want to duplicate contents in both Record_A and Record_B. Instead of that, store the content in ArticleDetailsRecords and make a relationship to Record_A and Record_B

Is that possible? Or is there any workaround?

The question you’re asking is exactly where the limit draws between Algolia and a relational database. The speed of our search engine comes in part from the way it handles the data: the absence of ways to do the equivalent of JOIN queries is part of those constraints.

We have part of our documentation discussing exactly this topic: Handling Data Relationships | How to | Sending and Managing Data | Guide | Algolia Documentation .
A short summary is that the usual way to handle this is through denormalization: duplicating this data directly in the object.
There’s a limit to how much you can do this: record size in Algolia is limited depending on your plan (starting at 10KB / record).

The alternative when the data is too big is to retrieve the information only after you’ve retrieved the search results.
For instance, getting a list of available variants for a product (colors & sizes) can wait until the user hovers over the item in the result list or clicks an “Add to cart” button.

1 Like