HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

Exclude fields

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

Public properties on an object are included 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.


using Newtonsoft.Json;

public class User
    public string Username { get; set; }

    public string Password { get; set; }

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

//using EPiServer.Find.ClientConventions;

  .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.