November Happy Hour will be moved to Thursday December 5th.

Loading...
Area: Optimizely Search & Navigation, Optimizely Personalized Search & Navigation
Applies to versions: 12.6 and higher

Personalized Find

Recommended reading 

Personalized Find is a personalization service that you can add to Episerver Find. This topic describes how to work with Personalized Find search attributes and values provided to the Episerver Find search client to boost search hits.

Note: At this time, Personalized Find only works with Episerver Commerce.

NuGet packages

To install Find Personalization, install these NuGet packages (in addition to Episerver.Find).

See Installing Episerver updates.

Configuration

To enable retrieval of search attributes, configure the Attribute API. The required attributes are episerver:personalization.Site and episerver:personalization.ClientToken. See Episerver Recommendations for information about configuring the Recommendations API.

Retrieving attributes

Before executing a personalized find query, the attributes must be fetched from the Recommendations API. This is not a quick process, so the attributes must be fetched and stored or cached for fast retrieval before the user needs them. In this way, latency is not adversely affected when a site visitor executes a query or filter.

There are two ways to retrieve attributes:

  • Call the Refresh method on an instance of the EPiServer.Find.Personalization.IPersonalizationClient. To retrieve the active EPiServer.Find.Personalization.IPersonalizationClient instance, call the Personalization() extension on EPiServer.Find.Personalization.IClient.

  • Decorate a controller with an EPiServer.Find.Personalization.RefreshPreferences attribute. This gets attributes from the API when any action method on the controller is executed (Hint: To avoid unnecessary refreshing, check the IPreferenceRepository for attributes first, or use the controller to track if a refresh has already been done for the visitor).

The Recommendations API call is done asynchronously, so has little effect on the time to execute the controller.

After retrieval, the attributes are stored in an EPiServer.Find.Personalization.IPreferenceRepository. The default implementation stores the attributes in the session and in a cookie, for fast retrieval during the session or between sessions no longer than 2 days apart.

If you want to override the default, implement EPiServer.Find.Personalization.IPreferenceRepository and change the implementation using the conventions during initialization: IClient.Personalization().Conventions.PreferenceRepository. The interface has two methods to implement, Save and Load, which are self explanatory.

Executing personalized Find queries

To enable personalization in Episerver Find queries, add .UsingPersonalization() to the query on the search client. The results are scored according to attribute data.

Example

var result = _client.Search<ProductContent>()
     .For("ferrari")
     .UsingPersonalization()
     .GetContentResult();
Do you find this information helpful? Please log in to provide feedback.

Last updated: May 23, 2018

Recommended reading