For one of our customer websites we developed new features, but also get rid of some unused functionality. During the implementation we had to change some properties types and move them into different models. We didn’t want to create drafts for published pages, so for saving content we used GetForceCurrentVersionSaveAction extension method.

After we start testing, it turns out that for some blocks the “This item is not used anywhere” was displayed. We knew that each of those blocks were used at least on one page. The information in the top bar is important for editors, because they use it to determinate where the block is used.

block not used anywhere

We figured out that the problem is related to Soft Links index. When saving the content with ForceCurrentVersion flag, the publish event is not fired and references are not reindexed.

I found the blog post about rebuilding Soft Link index. The code was written for EPiserver 6 platform and used LazyIndexer class. This class is still available in new EPiServer, but it’s mark as obsolete. Executing IndexPage method has absolutely no effect because it looks like the body is empty 🙂

In current platform version the ContentSoftLinkRepository and ContentSoftLinkIndexer should be used when rebuilding index.

Reindexing soft links admin plugin

To repair all block and page references we prepared Admin plugin. It iterates through all pages and reset Soft Links.

Reindex SoftLinks

After running the tool, all content was fixed and now the top ribbon is showing the correct information.

block referenced types

Full source code is available on Gist