Introduction to Entity Relationships in Search | Yext Hitchhikers Platform
What You’ll Learn
In this section, you will learn:
- The purpose of dot notation and how to utilize it
- The difference between direct and multihop entity relationships
Entity Relationships in Search
Linked entities are a powerful tool in Search as their data can be used to return specific results or display information that may exist across multiple entities that are related to each other.
In the case of Turtlehead Tacos, a restaurant location may be limited to only showing menu items with multi-option select or text-type fields (and any data changes would need to be made manually within the field). However, relating or linking Menu Item entities to Location entities allows customers to see other relevant information about dietary restrictions or ingredients of specific menu items to help them choose a location that best serves their needs.
Dot Notation
When referencing data from linked entities in Search, you will use dot notation. Dot notation (.
) allows data (in this case, entity fields) to be accessed from base and linked entities to then be utilized on both the frontend and backend of a Search experience. It should be formatted like this:
[[customRelationshipFieldID]].[[fieldName]]
OR
c_relatedProducts.c_customField
For example, if we want to return the name of menu items that are sold at a specific Turtlehead Tacos location the dot notation would be formatted something like this:
c_relatedMenuItems.name
Types of Entity Relationships
We will cover how to set up and utilize entity relationships in Search more in the following units, but there are two types of entity relationships that you can use:
Direct Entity Relationships - This allows you to return data across entities that are related to each other.
Multihop Entity Relationships - This allows you to return data across entities that are not directly related, but have an intermediary relationship.