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
GitHubNuGetDev CommunityOptimizely AcademySubmit a ticket

Optimizely developer documentation

How can we help you?

Try our conversational search powered by Generative AI!

AI OnAI Off

Exclude fields

Describes how to exclude public properties on indexed objects in Optimizely Search & Navigation.

Optimizely Search & Navigation includes public properties on an object when indexing it by default. The simplest way to exclude a property is to annotate it with the JsonIgnore attribute in the Newtonsoft.Json namespace.

Example

using Newtonsoft.Json; public class User { public string Username { get; set; } [JsonIgnore] public string Password { get; set; } }

You can also exclude properties or other previously included fields by customizing the client conventions.

//using EPiServer.Find.ClientConventions; client.Conventions .ForInstancesOf<User>() .ExcludeField(x => x.Password);

The above code excludes the Password property from instances of the User class and instances of classes that inherit the User class.


Did this page help you?