Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

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

Introduction

By default all public properties on an object are included when indexing it. Below we describe how properties can be excluded.

Examples

The simplest way to exclude a property is to annotate it with the JsonIgnore attribute (found in the Newtonsoft.Json namespace).

C#
using Newtonsoft.Json;

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

    [JsonIgnore]
    public string Password { get; set; }
}

It is also possible to exclude properties, or other previously included fields, by customizing the Client conventions.

C#
//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 as well as instances of classes that inherit the User class.

Last updated: Feb 23, 2015