• Publisert
  • 1 min

Problems with EPiServer SearchDataSource and globalization

<p>When searching in a globalized solution, property values set only on the Master language branch are not visible in search results.</p>

Property values invisible in search results

On a customer's site, we had a person search feature which used SearchDataSource. The site was globalized with two languages activated. 

In the Person pagetype, several properties were not unique per language (e.g. Mobile and Picture), since these were the same regardless of language. This means that the properties only have a value set in the Master language branch.

The problem: When the secondary language was active, properties which only had a value set in the Master language branch were not visible in the search results - these properties returned no value.

Solution: Get the property value from Master language branch

When coding the search results page, get the value from the Master language branch for those properties that are not unique per language:

<EPiServer:Property runat="server" PropertyName='<%# (Container.CurrentPage as EmployeePage).GetPropertyName(p => p.Mobile) %>' PageLink="<%# Container.CurrentPage.PageLink %>" />