Area: Episerver Find, Episerver Personalized Find
Applies to versions: 12.6 and higher (Find)

Personalized Find sample code

This topic describes how Find integrated with Personalization can boost results based on customer behavior data extracted from Personalization.

This topic also provides sample code for comparing search results that use .UsingPersonalization() versus searches that do not use it. The sample code uses APIs that were introduced in the Personalized Find documentation.

Note: Recommendations and Personalization Find are applied to Commerce content only this time.  Also, the .UsingPersonalization() syntax only boosts Commerce content properties.


1. Install Quicksilver - the Commerce template.

2. Install these Nuget packages:

3. To your site's web.config file, add the following configuration information from your Episerver.Personalization.Commerce package.

4. Verify that the data tracking and recommendations work as expected. 

5. View some product pages, so the Personalization system can track your behavior.

Verifying customer attributes from Personalization

Create a new page type. Name it PersonalizedFindPage.

The view result looks like this:

Make sure the returned attributes are not empty.

Compare search results with/without UsingPersonalization

Use this sample code to get a Personalization-based search result. This sample adds .UsingPersonalization() to the search query.

Note: Personalized Find works only with free-text search queries as described in Searching.

var resultsPersonalized = _client.Search()

Then, add another search query without .UsingPersonalization(), to compare results.

var resultsWithoutPersonalized  = _client.Search()

To preview the result in a UI, add more properties to the model.

The search query that uses .UsingPersonalization gives results that are boosted using customer attributes. And the search results are ordered differently. 

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Aug 13, 2019