Get in touch 01795 905292

Migrating Examine code to Umbraco Search on Umbraco 17 - Part 2 of 3

Migrating Examine code to Umbraco Search on Umbraco 17 - Part 2 of 3

This is part 2 of a three-part blog series based on my talk, From Examine to Umbraco Search, at the Umbraco Kent Meetup on 16 November 2026. If you haven't read it yet, start with part 1: What is Umbraco Search? A guide for Examine developers. You can also watch the recording on the Umbraco Community YouTube channel.

  1. What is Umbraco Search? A guide for Examine developers

  2. Migrating Examine code to Umbraco Search on Umbraco 17 (this post)

  3. Upgrading to Umbraco 19 with a custom Examine index

Part 1 covered what Umbraco Search is and how indexing and ISearcher work. Now the code: two implementations you'll recognise from the Umbraco 17 docs, taken from before to after, then a plan for the migration as a whole. Both examples come from Kenn Jacobsen's sample repository, which goes with his post From Examine to Umbraco Search. Thanks to Kenn for both.

But first, one change that arrives with the provider whether you touch your code or not.

Umbraco 17's core uses Examine 3, which on 17.7 is 3.10. The Umbraco Search Examine provider depends on Examine 4.0.0, so the moment you install it, every Examine index on the site moves to Examine 4, your custom ones included. Umbraco 19 stays on Examine 4.

The headline feature in Examine 4 is built-in faceting: string values, numeric ranges and hierarchical facets, with new field types like FacetFullText, FacetInteger and FacetDateTime. Facets are stored either in doc values or in a taxonomy sidecar index. Taxonomy is Examine's default, and hierarchical facets need it, but the Umbraco Search provider turns it off on every index unless you set it in your own named options.

In my testing, Examine 3 query code compiled unchanged, and Umbraco 17's UmbracoContentIndex ran fine on Examine 4. Any hand-rolled Lucene facets can go.

Umbraco Search field names in Examine

IExamineManager is still there on 19, but Umbraco Search's indexes use their own field names. Every field is stored as Field_, then the Umbraco Search field name, then its type. So Umb_Name becomes Field_Umb_Name_textsr1, a title property becomes Field_title_texts, and one property can produce several fields, one per value type. ISearcher uses the plain names, but raw Examine queries against these indexes need the full ones, so they need rewriting. Kenn explains the naming scheme in Can I still use Examine with Umbraco?

Porting an IExamineManager query to ISearcher

Example A: an IExamineManager query

This is the classic approach. Ask IExamineManager for the External index by its name constant, build a fluent query for only the "page" document type using NodeTypeAlias, and match on the node name. Then take ten, and map the IDs back to content through UmbracoHelper.

if (!_examineManager.TryGetIndex(
        Constants.UmbracoIndexes.ExternalIndexName,
        out var index))
    return Problem("Index not found");

var ids = index.Searcher
    .CreateQuery("content")
    .NodeTypeAlias("page")
    .And()
    .Field("nodeName", query)
    .Execute(QueryOptions.SkipTake(0, 10))
    .Select(x => x.Id);

var names = ids
    .Select(id => _umbracoHelper.Content(id)?.Name)
    .WhereNotNull()
    .ToArray();

It's coupled to ExternalIndex by name and to Umbraco's NodeTypeAlias extension, and both are gone in 19. And watch that NodeTypeAlias line. It only works because Umbraco's value sets put the alias in the index. Umbraco Search doesn't.

Content type aliases: the missing link

The getting started docs cover almost everything you need to port Example A. The one gap is NodeTypeAlias. Examine's value sets included the content type alias, but Umbraco Search only indexes the content type key, in the Umb_ContentTypeId field.

So resolve the key from the alias at runtime with IPublishedContentTypeCache, then filter on that key with a KeywordFilter. If you need several types, resolve each one.

var pageContentTypeKey = _publishedContentTypeCache
    .Get(PublishedItemType.Content, "page")
    .Key;

Example A ported to ISearcher

var result = await _searcher.SearchAsync(
    indexAlias:
        Constants.IndexAliases.PublishedContent,
    filters:
    [
        // was .NodeTypeAlias("page")
        new KeywordFilter(
            Constants.FieldNames.ContentTypeId,
            [pageContentTypeKey.AsKeyword()],
            Negate: false),
        // was .Field("nodeName", query)
        new TextFilter(
            Constants.FieldNames.Name,
            [query],
            Negate: false)
    ]);

var names = result.Documents
    .Select(d => _umbracoHelper.Content(d.Id)?.Name)
    .WhereNotNull()
    .ToArray();
  • IExamineManager becomes ISearcher, and ExternalIndex becomes the PublishedContent index alias.

  • NodeTypeAlias becomes a KeywordFilter on the ContentTypeId system field, using the key we resolved, formatted with AsKeyword.

  • The nodeName match becomes a TextFilter on the Name system field.

Keyword versus text matters here. Keywords are exact matches on unanalysed values, and texts are full text. Use the wrong one and you just get no results, with no error to tell you why. The result gives you document keys, which you map back to content exactly as before.

Replacing IPublishedContentQuery.Search()

Example B: IPublishedContentQuery.Search()

Example B is even simpler, and very common in Razor views:

var result = _publishedContentQuery.Search(query);

var names = result
    .Select(r => r.Content.Name)
    .ToArray();

The text overload is keyword only. It can page if you pass skip and take, but it can't filter on property values or sort by anything other than relevance. So you end up materialising published content and filtering, sorting and paging it in memory. It's not recommended.

It also hides in views, so it's easy to miss. Search your Razor files for .Search( before you start, including starter kit and package views.

Why Example B breaks

Once you've disabled the default indexes, IPublishedContentQuery.Search() has nothing to query, and you get a 500 error:

No index found by name ExternalIndex or is not of type Umbraco.Cms.Infrastructure.Examine.IUmbracoIndex

The message is cryptic, so learn to recognise it. It's also useful, because it flushes out code that still relies on the old indexes.

The quick replacement is ISearcher with the query, and take set to int.MaxValue:

var result = await _searcher.SearchAsync(
    indexAlias:
        Constants.IndexAliases.PublishedContent,
    query: query,
    take: int.MaxValue);

It works, but it isn't like-for-like. The original quietly stopped at Examine's default of 100 hits, while this fetches every match, up to Examine's cap of 10,000, still unfiltered. So don't stop there. Search() does come back on 19, with caveats, which part 3 covers.

Doing it properly: filter and page in the index

This goes beyond Kenn's samples, which he's clear aren't meant as best practice. It's a small service that resolves the page type key, then lets the index do the work: the free-text query, a KeywordFilter for the content type, and skip and take for paging. You only materialise the items you actually render.

public async Task<SearchResult> SearchPagesAsync(
    string query, int pageIndex, int pageSize = 10)
{
    var pageKey = _publishedContentTypeCache
        .Get(PublishedItemType.Content, "page").Key;

    return await _searcher.SearchAsync(
        indexAlias:
            Constants.IndexAliases.PublishedContent,
        query: query,
        filters:
        [
            new KeywordFilter(
                Constants.FieldNames.ContentTypeId,
                [pageKey.AsKeyword()],
                Negate: false)
        ],
        skip: pageIndex * pageSize,
        take: pageSize);
}

While you're in here, it's a good moment to add facets. Keyword, integer, decimal and date facets are supported, once the fields are declared in FieldOptions (see the Examine search provider docs).

  1. Umbraco 17 today. Where most of us are: search built on IExamineManager or IPublishedContentQuery. If you're not on 17 yet, these are the Umbraco upgrade paths.

  2. Umbraco 17 with Umbraco Search. Install the add-on, port the code to ISearcher, then switch off the old default indexes. This is where the work is, and it's what this post has walked through.

  3. Umbraco 19 and beyond. Remove the add-on, upgrade, and tidy up. If stage 2 was done properly, it's almost a non-event.

Why switch off the default Examine indexes?

Leaving both running while you port is sensible. But once you're done, switch the old indexes off, for three reasons:

  • Server resources: there's no point maintaining ExternalIndex, InternalIndex, MembersIndex and the Delivery API index next to Umbraco Search's own indexes.

  • Drift: Umbraco Search updates its indexes with its own logic, separate from Umbraco's. Two pipelines can disagree and give inconsistent results.

  • It flushes out stragglers: anything still using ExternalIndex stops working now, on 17, where you can fix it, rather than after the 19 upgrade. IPublishedContentQuery.Search() throws, but code using IExamineManager just doesn't find the index, so check it doesn't fail quietly.

It hides only Umbraco's four core indexes from IExamineManager, so they're neither populated nor queryable. Custom indexes aren't affected, so a custom index keeps working alongside Umbraco Search.

Breaking changes to plan for on Umbraco 17 and 18

  • DisableDefaultExamineIndexes() breaks IPublishedContentQuery.Search().

  • Content types are indexed by key, not alias.

  • Moving a query to Umbraco Search means rewriting it, with new field names and value types.

  • Facet and sort fields are declared before indexing.

  • Keyword results change: every term must match, with prefix matching and R1 to R3 boosts.

  • Searches only cover invariant, unprotected content unless you pass a culture and an AccessContext. Multilingual and member sites need that in every query.

Next: upgrading to Umbraco 19

With stage 2 done, the upgrade should be the easy part. In part 3 I cover the Umbraco 19 upgrade steps, what still works afterwards, and the harder case: a site with its own custom Examine index and facets, migrated four different ways, with the demo projects on GitHub.

Read part 3: Upgrading to Umbraco 19 with a custom Examine index

Talk recording, slides and further reading

Justin Neville

Written by Justin Neville

Justin has worked in software development since 1998. He began writing C and C++ applications, moving to C# and .NET development in 2002. From 2002 to 2013 he built large-scale internal web applications for major companies in the finance and insurance sectors. In 2013, he founded Nevitech IT Solutions Ltd, and since then has focused exclusively on building and supporting websites using Umbraco CMS.

Justin is an Umbraco Certified Master and an Umbraco MVP for 2026. He won the Umbraco AI Package Award for his AI Log Analyser package, contributes to the Umbraco CMS core, and co-organises the Umbraco Kent Meetup. His particular strengths include system architecture, performance optimisation, complex troubleshooting, and writing clean, scalable code. He also mentors junior developers and works closely with agency partners on complex builds requiring specialist expertise.

More articles by Justin