Module Assessment | Yext Hitchhikers Platform
Background
In the last challenge you created a Search config with verticals for events and restaurants. Now it’s time to set up these two verticals. Additionally, you know that people are always asking about things like gift cards. You want to make sure you can answer these questions in Search so you decide to add an FAQs vertical to your config and set that up as well.
To set up these three verticals, you will add:
- A new vertical - You will first add the FAQs vertical to the Search config.
- Saved filters - Saved filters allow you to choose which entities can potentially show up in Search.
- FAQs vertical - You will show approved FAQs that have answers filled in.
- Restaurants vertical - You also want to make sure diners don’t go to locations that are permanently closed by not surfacing them in search results.
- Events vertical - You don’t want to show events that have already passed, so you’ll filter for events in the future.
- Searchable fields - Searchable fields tell the algorithm which fields to index on. You’ll make promoting events searchable on the Restaurants vertical so that when users search for an event, the hosting restaurant surfaces.
- Facets - Having facets or filters available makes the end consumer experience so much easier. You’ll add facets to the Restaurants vertical for users to narrow their search based on restaurant features and restaurant type.
- Default Sorting - Default sorting allows you to set the order of results users see by default and show the most relevant results first. You’ll update the default sorting for the Events vertical to show events by relevance and then in chronological order.
Your Challenge
Before we make any changes, let’s check out what search results currently look like. Navigate to Search > Brand Search > Test Search. Test out a few queries in your full screen Test Search:
- Run a search for “faqs” and “gift cards”. Note how nothing is returned.
- Run a search for “Tyler, TX”. Note that the restaurant is still returning, but it’s marked as closed, which is a terrible customer experience!
- Run a search for “Find that tacomania” (the name of one of the most popular events). Note that the restaurant where this is taking place does not show up – only the event shows up.
- Run a search for “restaurants” and switch to the Restaurants tab. Note how no facets are shown.
- Switch back to universal search. Run a search for “events”. Note how the events are returned in a random order.
You’ll fix all of this in this challenge. Since we’re updating the configuration for verticals, you’ll make changes in the Verticals screen if you’re editing in the UI or in the verticals
object if you’re editing in the JSON editor.
Note: If you’re not seeing results when you run the above or your updates when you run the below in Test Search, wait 3-5 minutes and try again in case there’s an unexpected delay in the re-indexing of the data. If you’re still seeing issues, reach out to the Community for assistance.
Step 1: Add FAQs Vertical
- Navigate to Search > Brand Search > Edit as JSON. This is your JSON file that has your full Search configuration. Click into the file and search (CTRL+F) for “faqs”. You’ll notice that there are no matches – this is because you don’t have a vertical set up for FAQs yet! Feel free to scroll through this file to get familiar before we switch over to the UI to create your vertical.
- Navigate to Search > Brand Search > Verticals under the Configuration section. Click + Add Vertical.
- Create an FAQs vertical:
- Vertical Name: FAQs
- Vertical Key: faqs
- Entity Type: FAQ
- Then click Save and Configure.
- Some searchable fields were added to the FAQs vertical by default. Review them and make sure the below is true. If it’s not, click + Add / Update Fields under the relevant section to modify.
- Inferred Filter includes Entity Type
- Semantic Search includes Question
- Keyword Search includes Keywords
- Click Save.
- Search for “FAQs” and “gift cards” in Test Search. You’re now getting results. Navigate to the Edit as JSON screen and search for “faqs” like you did in step 2. You should now see your FAQs vertical in the verticals object with the searchable fields specified above.
Step 2: Add Saved Filters for the All Verticals
Check out the Saved Filters module in the Content track if you need a refresher on saved filters.
FAQs Vertical
- You want to add a saved filter for FAQs, but first you need to set up your Content. Add a custom field that is type Yes/No, is called “Active On Search”, has an API name of
c_activeOnSearch
, and is available to the FAQ entity type. Check out the Add Custom Field help article if you need help. - Bulk edit all of your FAQs so that “Active on Search” is set to “Yes”. Check out the Edit Entities in Bulk help article if you need help.
- Add a saved filter for FAQs called “FAQs on Search” with the following criteria. Check out the
Apply a Filter
help article if you need help.
- Entity Type is FAQs
- Fields with Data includes Answer (The Fields with Data filter allows you to filter to only those entities that have the specified field(s) filled out with content. This filter is making sure that only FAQs that have an answer will appear in search results.)
- Active on Search = Yes (This flag allows you to vet and select the entities you want to surface.)
- Now that you have the Content set up, add the saved filter you just created to the FAQs vertical in your search configuration.
- Navigate to Search > Brand Search > Verticals.
- Select the FAQs vertical and click on the Settings tab.
- For the Saved Filters property, click the dropdown and select the “FAQs on Search” saved filter.
Click Save.
Restaurants Vertical
In the Search configuration for the Restaurants vertical, add the existing saved filter for “Open Restaurants” that you created in the Content track. This time, edit it in the JSON editor. Find the existing Restaurants vertical object and place the
savedSearchId
property can be placed anywhere inside. For example, it could look like this:"restaurants": { "name": "restaurant", "savedSearchId": "[[INSERT SAVED FILTER ID]]", ... }
Make sure to copy the right saved filter ID from Content > Configuration > Saved Filters screen and that you surround the ID with quotes and include a comma at the end. You can reference your FAQs vertical for the proper syntax.
Click Save.
In Test Search, search for “Tyler, TX” again. Notice the restaurant has been removed.
Events Vertical
In Content, create a saved filter for Events called “Events in the Future” with the following criteria:
- Entity Type is Events
- End Date/Time is in the future
Add the saved filter you just created to the Events vertical under Settings. You can choose whether to use the UI or JSON editor.
Click Save.
Step 3: Add Searchable Field for Restaurants Vertical
- Go to the entity with entity ID 42 and update the Promoting Events field to include the event called “Find that TacoMania!” (event-5).
Add an inferred filter in the Restaurants vertical for the linked Events in the Promoting Events field. Remember that linked entity fields can index the name of the linked entities like this:
c_fieldName.name
or in this casec_promotingEvents.name
.- To do this in the UI, click the dropdown in the breadcrumbs to switch to the Restaurants vertical. Then click on the Filters tab. Click on + Add / Update Searchable Fields in the inferred filter section and check off the
c_promotingEvents.name
field. Click Update. To do this in the JSON editor, navigate to the Edit as JSON screen and scroll to your “restaurants” vertical object. In
searchableFields
, you should see fields likename
,builtin.entityType
,builtin.location
, andmainPhone
. Addc_promotingEvents.name
withnlpFilter
set to true. It should look like:"restaurants": { "entityTypes": [ "restaurant" ], "name": "Restaurants", "searchableFields": { "builtin.entityType": { "nlpFilter": true }, "builtin.hours": { "nlpFilter": true }, "builtin.location": { "nlpFilter": true }, "c_promotingEvents.name": { "nlpFilter": true }, "keywords": { "phraseMatch": true }, "name": { "textSearch": true } }, "sortBys": [], "source": "YEXT" }
Click Save.
- To do this in the UI, click the dropdown in the breadcrumbs to switch to the Restaurants vertical. Then click on the Filters tab. Click on + Add / Update Searchable Fields in the inferred filter section and check off the
In Test Search, run a search for “Find that TacoMania”. The restaurant shows up!
Step 4: Add Facets to the Restaurants Vertical
- In the Restaurants vertical, add the following fields as facets. Follow the instructions above to edit either in the UI or JSON.
- Restaurant Features (
c_restaurantFeatures
) - Restaurant Type (
c_restaurantType
)
- Restaurant Features (
- Click Save.
- Navigate to Test Search and run a search for “restaurants”. Switch to the Restaurants tab. You’ll see the facets next to the results. Click on a couple to see how they narrow down results.
Step 5: Add Default Sorting to Events Vertical
We want to sort the events chronologically. To do so, we’ll sort on the Start (time.start
) field. Since this is a subfield, it is not found in the UI and must be added via the JSON editor. To do this in the JSON editor, navigate to the Edit as JSON screen and scroll to your “events” vertical object.
Since we’re adding field sort via the JSON editor, you first need to add the field as sortable to searchable fields. In the Events vertical searchable fields object, add “Start” (
time.start
) as sortable. It should look like:"events": { "searchableFields": { "time.start": { "sortable": true } } },
Update the default sort order: in the
sortBys
array, add two objects, one for each rule. It should look like:"events": { "sortBys": [ { "type": "RELEVANCE" }, { "type": "FIELD", "field": "time.start", "direction": "ASC" } ] },
Click Save.
In Test Search, run a search for “events” again. Note the restaurants are listed chronologically now.
Great, you’ve set up the Restaurants, FAQs, and Events verticals for your Brand Search!
This is likely because you included an object that was not recognized and the Yext system is removing it from the config and saving any other changes.
If you’re adding something that is top-level, like the synonyms or autocomplete objects, make sure it’s not nested inside of a vertical. Conversely, if you’re adding a searchable field or a saved filter, make sure it is nested appropriately.
Make sure you have the right syntax and is an NLP filter. It should look like this:
"c_promotingEvents.name": {
"nlpFilter": true
},
There are two common causes:
The syntax is off – the property is called “savedSearchId” (case sensitive) and the filter ID should be encased in quotations (the filter ID can be an alphanumeric string, it’s just that those created in the UI happen to be numeric)
The filter is invalid. Make sure you’re copying a valid filter ID from account settings.