This content is archived. See latest version here

This document provides an introduction to search in the EPiServer platform, and Commerce in particular. Search in EPiServer is based on the Lucene search engine, which is part of the EPiServer Framework, supporting full-text search indexing and ranked search results. The search engine itself is based on the ASP.NET provider model meaning you can write your own providers to search servers. Search in EPiServer Commerce is also based on Lucene by default, but Commerce has its own plugable API for search providers.


  • Refer to the Search section in the EPiServer Framework for a description of the built-in full-text search in the EPiServer platform.
  • Refer to the Search section in the EPiServer CMS SDK for a description of search integration in CMS.
  • The Search section in the EPiServer Commerce SDK explains specific search features and possibilities in Commerce.

Search in Commerce

EPiServer Commerce includes an extensive system wide search engine. Any information can be made available to the search engine, even if that information is not in the EPiServer Commerce Database. Some systems such as Catalog and Orders, also have specific additional search features. By default, EPiServer Commerce uses the Lucene Search Engine, supporting full text search indexing and ranked search results.

The search engine itself is based on the ASP.NET provider model meaning you can write your own providers to search servers. EPiServer Commerce comes with providers for Lucene and SOLR. EPiServer Commerce can also be integrated with EPiServer Find, to create advanced search based navigation and filtering for websites.

Classes referred to here are available in the following namespaces:

Refer to the Search section of the EPiServer Framework SDK for an introduction to the search concept in EPiServer.


EPiServer Commerce has a layer built on top of Lucene for easy integration. There is a MediachaseSearch layer to provide a base layer to simplify the interface. This base can be used to create an index for any data source, while you still have access to the Lucene classes. Searchable data is written to a file index.

Search Architecture

SearchExtensions provides a catalog indexing and searching implementation using the MediachaseSearch layer. This is built into Commerce Manager and includes several controls making use of this implementation. You can create you own search implementations on top of MediachaseSearch.


In order for the data to be available it will first be indexed. The indexing is done by the call to the Mediachase.Search.SearchManager.BuildIndex(bool rebuild) method. This method is called by either clicking "Build" or "Rebuild" buttons in the Commerce Manager or through the Quartz service that calls BuildIndex method on the predefined schedule.

The individual indexer implementations are defined in the file. The default catalog indexer included, Mediachase.Search.Extensions.Indexers.CatalogIndexBuilder, Mediachase.Search.Extensions, reads the catalog data and calls the SearchProvider.Index(string applicationName, string scope, ISearchDocument document) method.

The method must be implemented by the provider that is currently configured. The provider will be passed an ISearchDocument containing the properties that need to be indexed. You can either replace the indexer completely or extend the existing indexer by inheriting CatalogIndexBuilder class and overriding OnCatalogEntryIndex method. New indexers can also be added.

By default the indexer only populates fields that are marked searchable in the meta configuration as well as some of the system fields like price, name and code. Depending on the provider, additional configuration changes need to be made for those fields to make it to the index.

Calling BuildIndex with rebuild = false will only add indexes that has changed since the last index was created. The system keeps track of when the last index was performed using the ".build" file. Location of the ".build" file is configured inside Mediachase.Search.config file for each indexer defined.

Example: build index command

1 SearchManager searchManager = new SearchManager(applicationName);
2 searchManager.BuildIndex(false);

Catalog meta data fields have options that allow you to specify:

  • Whether a field will be added to the index. This alone will not make the field searchable.
  • Whether the field value will be stored or not. Stored = stored in an uncompressed format. Not stored = putting the value into the index in a compressed format. You only store a value if you are going to use the value as part of the displayed text in the results to the user.
  • Whether the field is tokenized. A field must be tokenized to be searchable. When a field is tokenized, the text is broken down into individual searchable words and common words are omitted.


When the data has been indexed, this index will be searched. Search is done by calling the ISearchResults Mediachase.Search.Search(ISearchCriteria criteria) method. The method call is handled by the configured search provider and returns the ISearchResults interface.

Example: simple catalog search

1 CatalogEntrySearchCriteria criteria = new CatalogEntrySearchCriteria();
2 criteria.SearchPhrase = "canon";
3 SearchManager manager = new SearchManager(AppContext.Current.ApplicationName);
4 SearchResults results = manager.Search(criteria);

The search phrase can contain complex search syntax that is specific to a provider used.

Facets and filters

Another capability extending the Lucene.NET functionality is the ability to create Facets, which is a type of  filtering that can be used to further narrow a search. In the configuration file, facets such as SimpleValue, PriceRangeValue, and RangeValue types can be found.

Facets are organized into facet groups. A facet group is referred to as a Filter in the config file. For instance, a facet group would be Color, and a facet would then be Red. In the configuration, Color would be the filter and Red would be a SimpleValue. A facet group is linked to a particular field or meta field. Facets can be specified as part of the ISearchCriteria interface.

The front end includes controls that read special configuration file to automatically populate the facet property of the ISearchCriteria interface. These filters are stored in Mediachase.Search.Filters.config. To add a new filter simply add new field into index and add a record to the config file. The filter will appear as soon as the data is available.

Refer to the section Configuring Facets and Filters in the EPiServer Commerce SDK for related information

See also

  • The Search section in the EPiServer CMS SDK.

Last updated: Mar 31, 2014