This document provides an introduction to EPiServer Search and the built-in search features of the EPiServer platform. EPiServer Search is used by the global search available to users in the global menu in the EPiServer edit view, as well as the templates available in the EPiServer sample sites. The features in EPiServer Search are described in more detail below.
Search in EPiServer
EPiServer Search is integrated with CMS, and the underlying functionality is based on the Lucene search engine which is part of the EPiServer Framework. Search in EPiServer Commerce is also based on Lucene, but Commerce Manager (the back-end part of Commerce), has its own pluggable search provider API. Refer to the EPiServer Commerce Developer Guide for more information on Commerce-specific search.
You also have the option to use EPiServer Find, which is a cloud-ready extension allowing you to build more advanced customized search features based on your content model.
Built-in search features
The features listed below are available with the built-in search in EPiServer CMS.
Full-text search of text in content and files. You can specify whether you want exact matching of the result, for instance get a match on "plant" when you typed "ant" in the search field. You can build a property-based search, searching for instance for pages with a property set to something specific. You can also use categories in CMS to build a property-based search, filtering on categories set for the content.
Search across all content types such as pages, blocks, files, videos and images, product content in a Commerce product catalog, as well as community content. There is a built-in filtering limiting the search results to the type of content. One limitation here is that you will not get hits on content in blocks that are added in a content area in a template. Usually this is not a problem, since blocks are often used to promote content in a specific source page, which will be found when performing the search.
Facets are a type of filtering or grouping where you, after getting the first query from the user, present groups (facets) of content to limit the search. You can search on categories and content types, and define which facets you want to filter for categories and types.
Event driven indexing
Instead of crawling the entire HTML content of the site, you push the content you want to index to the search service. This will trigger automatically on specific events like new file uploads or published pages, adding items directly to the index, ensuring better site performance.
Index any type of content
You can index any type of content, including content from external systems using the search web service and an open protocol based on Atom. The index will be located in your server domain, and your search feature will have direct access to these through the local API.
Access-based search result filtering
Search results are filtered by access rights, ensuring that users will only see content they have access to.
Pluggable search interface
You can replace the built-in Lucene indexing with another index without needing to change the code on the client, which will still be using the same API when searching.
The most important related information is shown as you type the search phrase, and becomes more specific the more letters you type.
The easiest way of implementing EPiServer Search is to use the SearchDataSource control shipped with EPiServer. This built-in control will perform multiple types of search in page and file information and content.
The output can be sorted, filtered and configured using properties on the web control. There are built-in filters covering the most common filtering options. You can also create your own custom filtering methods for more complex filtering.Examples of the search functionality using the EPiServer SearchDataSource control can be seen in the EPiServer sample sites. Refer to EPiServer World to download and install sample sites for CMS and Commerce.
To gain even more control of the outcome when implementing a search solution, you can also work directly towards the ContentSearchHandler, or create your own custom queries. Some configuration and development efforts will be needed here.
Refer to the Search sections in the EPiServer CMS and Commerce SDKs, for more detailed information and examples of how to configure and implement product-specific search features.
Default search configuration
As mentioned the EPiServer search is index-based and is by default using the built-in full-text search feature. When installing CMS, an index will be created and added to the site folder structure. The EPiServer Indexing Service will then index files and documents for the versioned virtual path provider for the website.
Note that it is important that the indexing service is up and running in order for the website search to work and provide search results.
The full-text search in EPiServer comes with a set of default values, which most often does not need to be changed. If you want to find out how it works, the full-text search client and service and the configuration of these are described in the following sections of this documentation:
- About EPiServer full-text search client
- About EPiServer full-text search service
- Configuring EPiServer full-text search client
- Configuring EPiServer full-text search service
The built-in search provides some powerful possibilities when properly set up and configured. However, there are some limitations to consider when implementing EPiServer Search for your solution.
- As previously mentioned, the built-in search will not index blocks in content areas. Often these blocks contain linked references to other content, and therefore will not need to be indexed. If there is a need to index actual block content, the built-in full-text search will not be able to deliver this.
- In a load balanced environment, the supported scenario is to install the search service on one of the machines, and configure that machine in the search settings for other machines.
If you have advanced or specific requirements, another option may be to use EPiServer Find for your search solution. This will however require a separate license.
Search queries in CMS
The following options are available when implementing search queries in CMS:
- Custom Queries
SearchDataSource can provide PageData objects to your data bound controls in your page templates.
SDK entry for SearchDataSource: EPiServer.Web.WebControls.SearchDataSource
The ContentSearchHandler is a CMS-specific search handler that handles common scenarios when searching for content. It has methods like GetSearchResults and GetContent to simplify the development process.
SDK entry for ContentSearchHandler: EPiServer.Core.ContentSearchHandler
For more advanced search scenarios you have the possibility to build your own queries to ask the EPiServer Search Index. This can be done by grouping together different queries to find whatever you are looking for. You can use the following CMS-specific queries:
- ContentCategoryQuery when searching for categories
- ContentQuery when searching for content
- UnifiedDirectoryQuery when searching for unified directories
- UnifiedFileQuery when searching for unified files