Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Filters

Describes the built-in filtering extensions in the EPiServer.Find.Cms namespace for the Optimizely Content Management System (CMS) integration of Optimizely Search & Navigation.

CurrentlyPublished

CurrentlyPublished checks whether the content is currently published in any language.

SearchClient.Instance.Search<IContent>().CurrentlyPublished()

ExcludeDeleted

ExcludeDeleted excludes content that was moved to the trash (recycle bin). This method is important because, by default, content in the trash is indexed.

SearchClient.Instance.Search<IContent>().ExcludeDeleted()

FilterForVisitor

FilterForVisitor is a group of filters including ExcludeDelete, PublishedInCurrentLanguage, and FilterOnReadAccess.

FilterOnCurrentSite

FilterOnCurrentSite filters content of the current site that is being visited. This method uses SiteDefinition.Current.Id to determine which site is being visited.

SearchClient.Instance.Search<IContent>().FilterOnCurrentSite();

FilterOnReadAccess

FilterOnReadAccess filters content to which the end user does not have access. This method uses VirtualRoleRepository, which includes users, roles, and visitor groups.

SearchClient.Instance.Search<IContent>().FilterOnReadAccess()

PublishedInCurrentLanguage

PublishedInCurrentLanguage checks whether the content is published in the current language.

SearchClient.Instance.Search<IContent>().PublishedInCurrentLanguage()

Filter results by access rights

When integrating Optimizely Search & Navigation with Optimizely Content Management System (CMS), the search engine does not filter documents (such as pages or files) according to access rights. However, the return values from the IContent extension methods RolesWithReadAccess and UsersWithReadAccess are indexed. You can use these methods to ensure only users with access rights to the supplied roles or users see the content.

Example:

SearchClient.Instance.Search<StandardPage>()
    .For("Possibly secret stuff")
    .Filter(x => x.RolesWithReadAccess().Match("Everyone"))
    .GetContentResult();

📘

Note

Control access to UI features

  • Members assigned to the roles of WebAdmins, Administrators, SearchAdmins, and SearchEditors can access the Search & Navigation user interface.
  • Only WebAdmins, Administrators, and SearchAdmins can clear indexes.

See Shell module.