In the world of search, delivering accurate and relevant answers quickly is key to enhancing user experience. Coveo’s Smart Snippets already provide users with the most relevant information directly on the results page, saving time and effort. But what if we could push this functionality further?
In this post, I’ll walk you through a custom feature I’ve developed for Coveo Smart Snippets. I’ve integrated custom context into the model by setting specific context rules. This has influenced how Smart Snippets respond, tailoring them even more precisely to user needs. This custom enhancement ensures that the snippets not only show relevant content but do so in a way that is fine-tuned based on the exact query context, delivering an even smarter search experience.
Smart Snippet Model in Coveo
The Coveo Machine Learning Smart Snippets model shows users direct answers to their questions on the search results page. Instead of clicking on links, users can quickly see the most relevant answer right there.
The Smart Snippet scans the search results, picks the most relevant one, and displays it at the top of the page with the important content highlighted.
It also suggests related questions or topics in a “People also ask” section so users can explore more without leaving the results page
Concrete Scenario
Imagine you run a big online store where customers often search for details about products, such as their features, reviews, or prices.
Without Smart Snippets: When someone searches for “wireless headphones,” they might see a generic preview of the product page. This preview might not show specific details like features or reviews, so users might have to click through the page to find what they need.
With Smart Snippets: When someone searches for “wireless headphones,” the Smart Snippet Model provides a preview that highlights the key features, latest reviews, or pricing details directly in the search results. This way, users can see important information immediately without visiting the product page.
Example: If someone searches for “wireless headphone features,” the Smart Snippet Model will ensure that the search result preview shows the most relevant details about the headphones’ features. This helps users quickly find the information they seek and decide if the product is right for them.
Setting Up the Smart Snippet Model in Coveo Admin Console
Note: Before starting, you should have the required license to create a model of this type.
-
Access Coveo Admin Console: Log in to Coveo Admin Console with the necessary permissions.
-
Navigate to Recommendations: In the left-hand menu, click “models” under the “Machine Learning” section.
-
Create a New Model: Click the “Add Model” button to start the setup process and select the “Smart Snippets”.
In this step, you must choose the specific sources containing the items you want the model to learn from. This helps the model understand which information to use when training.
In this step, you can specify the metadata field, but it’s optional and can be skipped.
This step is also optional and can be skipped for now, but you can exclude CSS properties.
In this step, provide a name for your model and click “Start Building” to begin creating it.
You’ll see the status of your smart snippet model as “Build in Progress.”
Once the model finishes building, it will be marked as ready for association. -
Create a query pipeline: To utilize the Smart Snippets model, you need to create a dedicated Query Pipeline for proper association
-
Create Hosted Search Page: To implement the Smart Snippets model in the UI, follow these steps:
- Go to the ‘Search’ menu.
- Select ‘Search Page.’
- Click ‘Add Search Page.’
- Access the ‘Classic Interface Editor.’
- Enter the ‘Page Name’ and ‘HTML Title.’
- Click ‘Add Search Page’ again.
- Go to ‘Setup Search Page.’
- Select ‘All Content.’
- Click ‘Create Page.’
Integration of Smart Snippet Model in Hosted Search Page
To add Coveo’s Smart Snippet feature to your search interface, simply include the following HTML code to the hosted search page and then save and test it:
<div class="CoveoSmartSnippet" style="section.coveo-smart-snippet-content-wrapper : font-family: Lato, Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #373737; "> </div> <div class="CoveoSmartSnippetSuggestions" style="p { font-family: Lato, Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #373737; }"> </div>
- CoveoSmartSnippet: Displays the main answer snippet.
- CoveoSmartSnippetSuggestions: Shows additional related suggestions.
Results
After integrating the Smart Snippet Model into the search page, users will directly see relevant, concise snippets in the search results. These snippets highlight key information that matches their query.
To see the query-based snippets, Enter any search term in the search interface to view the snippets based on that term.
For Example:
search term: Customizing Search Results Ranking and Ranking Functions
Here, you also see the SnippetSuggestions, also called “People also ask.”
Inspect the current page and check the Network tab to view the smart snippet object. Look for the ‘questionAnswer‘ object under the Preview tab. You can also see the similarity score assigned by the model to the displayed snippets by checking the score value.
Conclusion
Coveo’s Smart Snippets provide a robust solution for delivering precise, contextually relevant information directly within the search results, significantly enhancing user experience. This blog demonstrated how to take this functionality to the next level by integrating custom context into the Coveo Smart Snippet Model, tailoring the snippets even further to meet specific query intents. This improves the relevance of the information and streamlines the decision-making process for users.