Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

CustomizedSearchBlock not considering current culture



We are using CustomizedSearchBlock for populating some dynamic results from EPiServer.Find, observing that, its resulting non current culture/language pages, eventhrough the resulted pages are configured with fallback language.


 A page named (about us), created in en-us and configured fallback with en->en-us

With above

If I visit or  both are working.

When I'm using CustomizedSearchBlock to result out the "en" page, its always giving the "en-us" not the "en".

CustomizedSearchBlock Controller code:

public override ActionResult Index(CustomSearchBlock currentBlock)
            IEnumerable<Category> selectedcategoriesLst = null;
            var selectedcategories = ((EPiServer.Core.ICategorizable)currentBlock).Category;
            if (selectedcategories != null && selectedcategories.Any())
                selectedcategoriesLst = selectedcategories.Select(x => _categoryRepository.Service.Get(x));
            int definedHits = currentBlock.CustomizedSearchSettings.NumberOfHits;

            CustomizedSearchSettings settings = GetSettings(currentBlock, defaultHits);
            CustomizedSearchBlock customizedSearchBlock = GetCustomSearchBlock(currentBlock, settings);

            var search = _customizedSearchBlockService.CreateSearchQuery(customizedSearchBlock);

            var contentTypeCategories = _categoryRepository.Service.Get(Constants.ContentTypeCategory)?.Categories;

            var results = search.StaticallyCacheFor(TimeSpan.FromMinutes(5)).GetResult(); // cache search results for 5 minutes

But the above same scenarion working fine in the reguler EPiServer Find search,

Find Reguler Search Query:


query = SearchClient.Instance.Search<SitePageData>()

Did anyone faced similer issue?

Dec 26, 2021 5:53

I am not sure if this should be considered a bug but I believe CustomizedSearchBlock use a UnifiedSearch in Episerver.Find.ClientExtensions that would normally not use. This one does _not_ set the language/analyzer according to PreferedCulture but the other in one in Episerver.Find.Cms.ClientExtensions does.

Feb 09, 2022 20:35
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.