Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable Facets have stopped working #964

Open
akfo opened this issue Apr 19, 2024 · 0 comments
Open

Configurable Facets have stopped working #964

akfo opened this issue Apr 19, 2024 · 0 comments

Comments

@akfo
Copy link

akfo commented Apr 19, 2024

The feature described on this page is still part of the Foundation project, but it seems to have stopped working either in the latest version of Foundation or with the latest version(s) of Optimizely:

https://world.optimizely.com/blogs/calin-lupas/dates/2019/12/configurable-episerver-find-facets-by-editors/

There seems to be multiple issues with the current code:

  1. Setting up facets not working because Filter Type drop-down is empty
  2. During site startup, Facets initialized before settings are initialized
  3. During site startup, Settings initialization not working because they are not initialized in a HTTP request

Regarding 1:
Search Filter Configuration is located on the "Demo Settings Import" page. When I navigate to Search Settings, and I try to either create or modify an exiting filter, I can't select a FilterType, so I can't modify filter:
image

Regarding 2:
During site startup, facets are initialized in the Foundation.Infrastructure.InitializeSite class, in the ContextOnInitComplete() method. This method loads the current SearchSettings, but this is not initialized yet.

SearchSettings are initialized in the SettingsService.InitializeSettings() method, which is called from the Foundation.Infrastructure class in the ContentInstaller() method. But this is called after the ContextOnInitComplete() method listed above.

Regarding 3:
The site settings located on the "Demo Settings Import" page is used to store the Search Settings. This settings page is loaded during site initialization, based on the ContextOnInitComplete() method mentioned above. A part of this process, is to find the Settings page in the current site. This takes place in the Foundation.Infrastructure.Cms.Settings.SettingsService class, in the GetSiteSettings() method. This method calls the ResolveSiteId() method.

The ResolveSiteId method uses the _httpContextAccessor.HttpContext.Request metod to find the current hostname based on the current request. But there is no Http Request during site initialization, so this method finds no site. And therefore it finds no settings. So it can't initialize facets during startup.

Conclusion:

It looks as if there have been some changes to the site initialization flow, resulting in Facets not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant