Try our conversational search powered by Generative AI!

Console Application for testing Find - no results



I've been trying to setup a little test console application for Episerver Search & Navigation.  This is something that the training course does.

We already have an index that we use for development, and have crawled content in there.  I can get results back from within Episerver, so I'm doing something wrong in the console app.

I have a reference to the Episerver.Find.Framework package in Nuget, and this setup in the app.config:

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

<episerver.find serviceUrl="[client secret]" defaultIndex="[Index reference]" />

It's a barebones program (see below), but not returning results.  I've even tried using fiddler to glean the differences between what's happening in Epi vs. the console.  I've tried using Typed vs. Unified as well.  

Would someone kindly point me in the right direction please?

			var client = Client.CreateFromConfig();

			//var hit = new HitSpecification();
			//hit.HighlightTitle = true;			

			var setup = client.UnifiedSearch(Language.English).ApplyBestBets().For("covid");
			//var setup = client.Search<LayoutPageData>().ApplyBestBets().For("covid");
			if(setup != null)
				var results = setup.Take(30).GetResult();


				Console.WriteLine($"Results Count={results.TotalMatching}");
				foreach (var result in results)
					Console.WriteLine($"Name = {result.Filename}");
				Console.WriteLine("Setup is null");
Jan 08, 2021 14:23

Hi Mark,

How are you creating the client? I guess Epi find can't use the standard way to create. What I would have tried is to put the find settings in the appsettings and create the client myself

	<add key="find:service:url" value="yourserviceurl"/>
	<add key="find:index" value="yourindex"/>

And use it in code

//get serviceUrl and indexName values from appSettings
var serviceUrl = ConfigurationManager.AppSettings["find:service:url"];
var indexName = ConfigurationManager.AppSettings["find:index"];
var remoteSearchClient = new Client(serviceUrl, indexName); 
var remoteSiteSearchResult = remoteSearchClient.UnifiedSearchFor(query).GetResult();

This is taken from a blog post from Mari Jørgensen


Jan 09, 2021 13:08


Thank you for the response, but it seems the client is being created properly with var client = Client.CreateFromConfig(); .  I've used fiddler and see the requests going to

The request is very basic in comparison to the one used directly from EPiServer though.  

    "query": {
        "filtered": {
            "query": {
                "query_string": {
                    "query": "covid",
                    "analyzer": "standard"
            "filter": {
                "term": {
                    "___types": "EpiSearchConsole.LayoutPageData"
    "facets": {
        "SearchCategories": {
            "terms": {
                "field": "SearchCategories$$string",
                "size": 100
    "fields": [
Jan 10, 2021 15:35

Hi Mark,

Below code worked for me, maybe you can give a try. :) 

Just add required references in project and  you are good to go. What is important here is projection, refer below article for the same.

    public class Program
        static void Main(string[] args)
            var client = new Client("Service_Url", "defaultIndex_willBeHere");
            var query = client.Search<IProductVariant>(Language.English)
                        .InField(x => x.DisplayName)
                        .InField(x => x.Summary)
                        .Select(x => new ProjectionModel
                            DisplayName = x.DisplayName,
                            Summary = x.Summary


            var searchResults = query.GetResult();
            if (searchResults.Count() == 0)
                Console.WriteLine("No result found");
                foreach (var item in searchResults)

    class ProjectionModel : IProductVariant
        public string DisplayName { get; set; }
        public string Summary { get; set; }

Edited, Jan 20, 2021 9:47

@Mark: Did you solve this one?

Feb 04, 2021 7:27


Thank you for checking on on this one.  Your timing is perfect.  I had not solved it but dropped this for a while.  I sorted out my issue by working with the entire CMS solution.  I have to do some search inhancements again and really wanted to get this console app working.  It would be a lot quicker to work with.

@Ashish, thank you for your response, but that didn't work out for me either.  I'm not quite sure what I'm doing wrong.  This is just a bare bones console app.  I was trying to just use UnifiedSearch so I didn't need to bring the entire page object model over from the main solution.


Feb 04, 2021 15:15

The UnifiedSearch documentation says: 

Note: The GetResult method modifies search queries by searching for objects that implement ISearchContent and for all types added to the UnifiedSearchRegistry. The GetResult method also adds a projection from ISearchContent to UnifiedSearchHit with sensible defaults, along with any type-specific projections added to the UnifiedSearchRegistry. Finally, before executing a search query (such as the GetResult method), Unified Search adds type-specific filters that were added to the UnifiedSearchRegistry.

How is UnifiedSearch "configured" in your main solution? Do you use unified search or typed search? Have you implemented ISearchContent interface or made any changes to conventions (UnifiedSearchRegistry)?

Feb 10, 2021 14:22


Thank you for this.  Sorry, I had to sit this down for a while.  I think you pointed out some vital information here.  ISearchContent has not been implemented.  I'll have to look into this and I'll update the thread with my results when I can.



Feb 26, 2021 15:35

I just wanted to loop back on this thread.  I think the problem I encountered was due to our site having multiple subsites.  In the Console application I believe the wrong default filter was being used, and it was filtering results for the wrong SiteId.

I came across this example and it seemed to give me results from all the sites.*qin1fn*_ga*NzQ5Njk3MTMxLjE2NjEzNTQ5NjU.*_ga_C7SLJ6HMJ5*MTY2NjgxMzY3Ni4zMy4xLjE2NjY4MTU1MDQuNjAuMC4w

This is an excerpt of code that Peter Gustafsson has in that above thread.  It was decompiled from Episerver.Find.CMS.  The FilterOnCurrentSite<IContentData>() was just commented out, and that allowed for results.

// Code from CmsUnifiedSearchSetUp.cs in Episerver.Find.Cms DLL 13.0.5
var cmsUnifiedSearchSetup = new EPiServer.Find.Cms.CmsUnifiedSearchSetUp();

    .PublicSearchFilter((Func<IClient, ISearchContext, Filter>)((c, ctx) => (Filter)c.BuildFilter<IContentData>()
    .CustomizeIndexProjection(new Func<IndexProjectionBuilder, IndexProjectionBuilder>(cmsUnifiedSearchSetup.CustomizeIndexProjectionForPageData))
    .CustomizeProjection(new Func<HitProjectionBuilder, HitProjectionBuilder>(cmsUnifiedSearchSetup.CustomizeProjectionForPageData));
Oct 31, 2022 15:28
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.