If you are using Episerver Search & Navigation (Formerly Find), you are likely using
GetContentResult() . While I’m fairly skeptical about it (if you do not need the content explicitly, it’s probably a good idea to use
GetResult instead), there are legitimate uses of the APIs. However, it can come with a surprise, and a not very pleasant one.
Your code probably looks like this
Looks good, right? You search for content with keyword “banana” and cache the result for 15 minutes.
But is it? Does your search result really get cached for 15 minutes?
As it might surprise you, it doesn’t.
GetContentResult() caches the result by default (unlike
GetResult() which does not), but it only caches for 1 minutes. Even thought you asked it to cache for 15 minutes.
The right way to do it is to use other overload which takes an int as parameter. That is the cache time in seconds, like this
In upcoming version of Find, the surprise will be fixed, but it’s probably a good idea to specify the cache time out explicitly.
I’ve seen this more than once, and this can be quite tiresome to fix the problem(s) after that. So here the TL;DR: If you are installing Find.Commerce to Commerce Manager, you are doing it wrong.
You’ll probably end up in the error like this
While loading .NET types from "EPiServer.Find.UI" the following error(s) was reported:
- System.IO.FileNotFoundException: Could not load file or assembly 'EPiServer.Cms.Shell.UI, Version=126.96.36.199, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The system cannot find the file specified.
File name: 'EPiServer.Cms.Shell.UI, Version=188.8.131.52, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'
=== Pre-bind state information ===
LOG: DisplayName = EPiServer.Cms.Shell.UI, Version=184.108.40.206, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
LOG: Appbase = file:///C:/EPiServer/FindSearchProvider/backend/
LOG: Initial PrivatePath = C:\EPiServer\FindSearchProvider\backend\bin
Calling assembly : EPiServer.Find.UI, Version=220.127.116.1148, Culture=neutral, PublicKeyToken=8fe83dea738b45b7.
Continue reading “Find.Commerce is not for Commerce Manager” →
I ran into this problem recently and while in the end it’s quite simple issue (Everything is simple if we understand it, right?), it costed me quite many hairs in the process – as it involved debugging with 3 solutions – Find.Commerce (where the problem appears), Commerce (where the router does the work), CMS Core (where the routers are handled). It was both fun, and confusing.
The problem as a customer has this code in an initialization module:
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
var firstCatalog = contentLoader.GetChildren<CatalogContent>(referenceConverter.GetRootLink()).FirstOrDefault();
var partialRouter = new HierarchicalCatalogPartialRouter(() => SiteDefinition.Current.StartPage, firstCatalog, false);
Continue reading “Find indexing job + HierarchicalCatalogPartialRouter: A note” →