Description
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.
Steps
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) .Take(10) .GetResult(); var terms = result.TermsFacetFor(x => (x as CustomRssContent).SearchCategories).Terms;
Please sign in to leave a comment.