You are initializing correctly, Check if find settings exist in your appSettings.*.json
By the way this was our error before we encounter the error mentioned in this topic.
The error below shows with these steps;
- Installed the Integration packages
> EPiServer.Personalization.Commerce 4.0.20
> EPiServer.Find.Personalization 15.0.0
- execute the personalized search queries using UsingPersonalization()
[ERR] [EPiServer.Find.Personalization.Api.RefreshPreferenceCommand] Could not execute the refresh command. Personalization unreliable. Error: Object reference not set to an instance of an object.
If seems you have a problem with circular reference. Your startup tries to add Commerce, which adds Cms, which adds CmsHost, which initializes your site, and try to initialize some attributes, which tries to get an instance of IClient, which will not be registered until you call AddFind().
I think that you can try to add this before AddCommerce or even AddCms
services.AddSingleton<IClient, Client>();
untested of course, but you can try
I'm trying to setup Personalized Search & Navigation (formerly Personalized Find) following this guide in the link, https://docs.developers.optimizely.com/digital-experience-platform/v1.1.0-search-and-navigation/docs/personalized-search-navigation
What I've done so far are;
- Installed the Integration packages
- Configure the attributes in appsettings.json
- Retrieve attributes using [EPiServer.Find.Personalization.RefreshPreferences]
- execute the personalized search queries using UsingPersonalization()
Upon starting the site I encountered this error below.
Is there anything else to setup?
Versions used:
- .NET 6
- EPiServer.CMS.AspNetCore 12.12.1
- EPiServer.Personalization.Commerce 4.0.20
- EPiServer.Find.Personalization 15.0.0