Beginner’s tutorial on EPiServer Find

This tutorial sums up what's needed to get started with EPiServer Find by creating a new index, populating it with content and then performing a basic search and presenting a simple search result.

  • Ted Nyberg
  • 3 October 2013
  • 0


This tutorial is based on EPiServer 7 and ASP.NET MVC, but you will probably find parts of this useful for WebForms as well.

Set up a new EPiServer Find index

You will need an EPiServer Find search index configured in order to try this out. Setting up a developer index is free and the process takes about a minute. You’ll find everything you need at

Adding the EPiServer Find configuration

When you set up your index you'll get some information on what needs to be added to web.config.

Basically, when you’re done you should have added a configuration section and an <episerver.find> element like the following to web.config:

        <section name="episerver.find" type="EPiServer.Find.Configuration, EPiServer.Find" requirePermission="false"/>

    <episerver.find serviceUrl="" defaultIndex="yourusername_indexname" />


Get the Nuget packages

Before we continue we need to add some NuGet packages.

I choose to add the EPiServer Find CMS Integration package. This in turn has two dependencies, so the EPiServer Find Client API and EPiServer Find Framework Integration packages will be included automatically.

EPiServer Find packages in the NuGet package manager

Add the EPiServer Find UI module

In order to get the EPiServer Find UI features you need to add the EPiServer Find shell module. This is easily done by adding the following to you <> element in web.config:

  <publicModules rootPath="~/modules/" autoDiscovery="Modules" />
  <protectedModules rootPath="~/secret/">
    <!-- EPiServer Find UI module -->
    <add name="Find">
        <add assembly="EPiServer.Find.Framework"/>
        <add assembly="EPiServer.Find.Cms"/>
    <!-- /EPiServer Find UI module -->

Now, if you reload the EPiServer UI you should see the Find option in the top menu:

EPiServer screenshot after adding the Find UI module

Index your content

If you go to Find –> Index you’ll see a summary of the index. You’re also able to explore the index to browse its contents. You’ll notice that the search index is empty at this point:

Screenshot of EPiServer Find index summary

EPiServer Find indexes content when:

  1. Content changes
  2. The scheduled job executes

EPiServer Find includes a scheduled job, accessible through admin mode:

Screenshot of EPiServer scheduled jobs

If you run it manually you will eventually see that EPiServer Find has indexed your site:

Screenshot of scheduled job result

If we return to Find –> Index we’ll see that our index has now been populated:

Screenshot of EPiServer Find index summary

Note: By default all public page type properties will be indexed.  You may exclude specific properties from indexing by either adding a [JsonIgnore] attribute or by modifying the behavior of the indexing client:

// This property will not be indexed by EPiServer Find
public string MyProperty { get; set; }

Perform a basic search

EPiServer Find relies heavily on extension methods, so first off you’ll want to add some using statements for common EPiServer Find namespaces:

using EPiServer.Find;
using EPiServer.Find.Cms;
using EPiServer.Find.Framework;

We search using the SearchClient singleton class. For example, we could do the following to search for pages of a specific page type that match some keywords:

var blogPostPages = SearchClient.Instance.Search<BlogPostPage>()
                                         .For("EPiServer Find code samples")

This will return all pages of type BlogPostPage that match the query “EPiServer Find code samples”.

Note: we could easily replace the type parameter like Search<PageData> to search for pages regardless of page type.

Displaying search results

In a basic scenario we could have a search result page of type SearchPage. It would have a controller and a view like any other page type.

However, in this case we want to enable a query string parameter cleverly named q which allows us to specify keywords to search for.

For example, if the URL to our search page is we could go to to search for “some keywords”.

To enable this I’ve created a basic PageController for my search page, and simply added a q parameter to the Index method:

public class SearchPageController : PageController<SearchPage>
    public ActionResult Index(SearchPage currentPage, string q)
        if (!string.IsNullOrWhiteSpace(q))
            // Search for any page matching the keywords
            // Unless we add Take() we'll get a maximum of 10 hits
            // Since we use GetContentResult we'll get a collection
            // of PageData objects (i.e. the matching pages)
            var searchResult = SearchClient.Instance.Search<PageData>()

            // A view model would be preferred, but for now
            // we'll just pass the search result to the view
            // through the ViewBag
            ViewBag.SearchResult = searchResult;

        return View(currentPage);

Now, in order to render a simple result list in our view we could add something like the following:

@if (ViewBag.SearchResult != null)
    <div id="search-results">
        @foreach (PageData result in ViewBag.SearchResult)


This will present us with a very basic search result, simply rendering a link for each page:



There's a lot more to EPiServer Find, obviously. More EPiServer Find code samples are coming up, for example to show how to filter results for visitors, apply best bets and related queries etc.