I found this when I was using a helper class to generate the custom title of my pages - to then be indexed. This class used the context to get a configuration item and therefore was throwing an exception for every page.
The simple solution here is that instead of referencing the context to get an item like follows:
var item = Context.Database.GetItem("Mypath");You reference the given database directly:
var webDb = Sitecore.Configuration.Factory.GetDatabase("web");This will now get the computed index field working as expected.
var item = webDb.GetItem("MyPath");
No comments:
Post a Comment