EpiFind can be a great option if you have aspirations of creating an all singing and dancing search provider in your project. For development purposes anyone can create a free EpiFind index very quickly. In today's post, I'm briefly going to talk you through how you can do this:
Create an EpiFind Account
First, you will need to navigate to find.episerver.com
Click on the 'Sign up for a developer index' button.
Fill in your log-in credentials, or create a new account and follow the details.
Click 'Create Developer Service'
Add in your 'Index name', the languages that you will want to index and sell your soul by clicking at the T&C's. Note, you will need to verify your account's email address before you are allowed to do this.
After creating your index, you will be presented with everything you need to get started with Find. First, you will get your publish and private URLs. You will also get the web.config configuration code to configure your Episerver project with Find. In my next guide, I'll detail how you can set-up EpiFind in your project.
In this tutorial, you will learn how to install Episerver Find and get it running within your website. If you are new to Episerver and you do not fully understand the search options available to you yet then I suggest you read, Review Of The Different Search Providers Available To Use On Your Episerver Project.
Setting Up An Index
As EpiFind is a SAS product you do not physically need to store anything locally. Instead, you will need to create a cloud account is to create a free dev account. To learn how to create an account you can use How To Set-Up A New Episerver Find index in Less Than 5 Minutes.
Enabling EpiFind in your web.config
After you create an account and a Find index, at the end of the process you'll be given access to some configuration similar to this:
Install the Episerver.Find.Cms Package
Open your Nuget Package Manager, right click on solutions 'Manage Nuget Packages', make sure you use the Episerver Nuget feed. If you haven't bumped into the Epi Nuget feed, read this, How To Install Episerver 7.5 Using the New Visual Studio Extension.
Enabling Find In The Episerver Backend
Before you can see EpiFnd, you will need to configure Episerver to display it. In your web.config (or potentially in episerver.config for legacy solutions), you should see a '' section, in here you will need to add this config:
So the complete config section should now look something like this:
Now compile your website and open your Episerver backend.
In today's post, I'm going to quickly cover how to manually trigger Epifind to index your website's content. If you are new to EpiFind I suggest you read, How To Setup EpiFind For the First Time. After installing EpiFind for the first time, none of your website content will have been indexed:
To manually force EpiFind to index your website's content, go to the scheduled tasks section in your admin:
In here, you should see a task called 'EPiServer Find Content Indexing Job'. In here, hit the 'Start Manually' button and sit back and wait for the job to finish.
When we go back to the 'Overview' section in EpiFind you should see your content.
EpiFind is a power search provider developed by EpiServer; if you've stumbled across this post and you're considering using EpiFInd I suggest you read this article, Review Of The Different Search Providers Available To Use On Your Episerver Project. In today's post, I'll cover some basic code snippets to query Find.
Performing A Basic Search
Performing a search is pretty easy. The best approach to query find is to inject the Find API, IClient. In this example, I'm returning a PageData object, we can then use the standard PageData properties to display that search result: like:
For those of you who are interested in the old singleton version,SearchClient, looks like this:
Querying finds EpiFind results in the ContentResult object being returned. ContentResult has several useful bits of data, like facets, total results and the search results themselves. To get the search results, you can use this code:
You can get the total number of results returned, like:
If you want to only search for certain content types, you can do that like this:
To get the facets, you can use this snippet:
EpiFind is very simple to get started with and offers a pretty powerful API. In today's post, I've covered some of the basic bog-standard ways to query find and display those results on your website.
This is a quick troubleshooting post in case anyone bumps into Structuremap issues with Find. On a recent project, when we tried to load the Find UI the website crashed with this exception:
An error has occurred.","ExceptionMessage":"An error occurred when trying to create a controller of type 'EditorialBoostingController'. Make sure that the controller has a parameterless public constructor
I've used Find on a couple of projects now and usually, out the box, it works with a structure map with no qualms... However, this time we got the dreaded 'parameterless error'. If you get this, it means that structure map has got its knickers in a twist and it doesn't know how to resolve something.
In this case, it's the client parameter. Jonas Bergqvist pointed me in a useful direction. If you find yourself in a similar situation, then in your structure map set-up code (which I'm assuming is in an initialization module). You can manually create a concrete instance of the client like so:
Hopefully, this might help save someone a few hours, enjoy!
If you ever encounter this issue when you try and view it, like so:
- How To Set-Up A New EPiServer Find index in Less Than 5 Minutes
- How To Setup EpiFind For the First Time
- How To Force EpiFind To Index Your Content
- How To Search For Content Using EpiFind
- There is no configuration specified for EPiServer.Find.IClient - Episerver Find
- Episerver Find - Unexpected token < in JSON at position 0