How to facet on search categories with connector content

  • Updated

Search connectors can be used to crawl external content like RSS feeds. Here is how to facet on connector results results using the SearchCategories property.


Note: As of April 10, 2023 you must create a custom class like the below. In the future the custom class will be unnecessary once backend changes are completed.  

Create a new CustomRssContent.cs class

// code placeholder
using EPiServer.Find.Framework;
using System.Collections.Generic;

namespace EPiServer.Templates.Alloy
    public class CustomRssContent : WebContent
        public List<string> SearchCategories { get; }

You can facet on a search for WebContent (the content that RSS Feed has crawled) using the custom class in conjunction with the .TermsFacetFor method.

var result = _searchClient.Search<WebContent>()
                    .TermsFacetFor(x => (x as CustomRssContent).SearchCategories)
var terms = result.TermsFacetFor(x => (x as CustomRssContent).SearchCategories).Terms;