Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely Search & Navigation
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Indexing related content

Sometimes you need to index not only the saved/published page, but also pages related to it to preserve consistency in the index. One such case may be if you have indexed the child count for a page and want to have it updated whenever a child page is published.

Examples

To index related pages, we set the RelatedPages convention to return the parent page when indexing. This way the parent page is reindexed and its child count updated.

C#
PageIndexer.Instance.Conventions
  .ForInstancesOf<PageData>()
  .RelatedPages(x =>
  {
    var relatedPages = new PageDataCollection();
    if (!(x.PageLink.CompareToIgnoreWorkID(PageReference.StartPage) || 
         x.PageLink.CompareToIgnoreWorkID(PageReference.RootPage)))
    {
      relatedPages.Add(DataFactory.Instance.GetPage(x.ParentLink));
    }
    return relatedPages;
  });

Note: This functionality is not related to finding pages with similar or related content. For such functionality, refer to the MoreLike method described in the Searching section of this documentation.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Nov 16, 2015

Recommended reading