November Happy Hour will be moved to Thursday December 5th.

Product Search Provider

Product version:

EPiServer Commerce 1.0 and 1.0 SP1

Document version:

1.0

Document last saved:

Introduction

The ProductSearchProvider is installed as part of the EPiServer Commerce and EPiServer Commerce Sample package installation. This technical note provides a description of the ProductSearchProvider and its configuration.

  • The ProductSearchProvider provides global search functionality in a EPiServer Commerce solution,
  • The ProductSearchProvider is utilized in the OnlineCenter. Using the quick search functionality it is possible to search for products contained in the commerce product catalog and for pages contained in the EPiServer CMS 6 site. The search result will be divided into a specific group (category) the in search result will be displayed as a list.

Table of Contents

Prerequisites

Installation of EPiServer CMS 6.

Installation and Configuration

  • Install EPiServer Commerce and EPiServer Commerce Sample package (the sample package provides data for testing search function).
  • After installing the EPiServer CMS core files, the ProductSearchProvider already exists at the system level.
  • Installing EPiServer Commerce will add the ProductSearchProvider config (orange line below) into the web.config of the EPiServer Commerce sample website:

<episerver.shell>
    <publicModules rootPath="~/modules/" autoDiscovery="Minimal">
      <add>
        <assemblies>
          <add assembly="EPiServer.Business.Commerce.Sample" />
              <add assembly="EPiServer.Business.Commerce" />
        </assemblies>
      </add>
    </publicModules>
    <protectedModules rootPath="~/cms/">
      <add>
        <assemblies>
          <add assembly="EPiServer.Business.Commerce.UI" />
        </assemblies>
      </add>
      <add />
    </protectedModules>
</episerver.shell>

Using ProductSearchProvider

  • Select the search icon (a magnifying glass), input a search keyword and click on the Search button. A hit list of pages and products will then be listed.
  • When selecting a page or product from the list column you will be redirected to the specific page in edit mode or if it is a product to the Commerce Manager and to the specific product item.

 

Adding a Search Provider

Adding a Search Provider in short:

  1. For background information read the AddingSearchProviders section in the OnlineCenter Developer document.
  2. The following assemblies must be included in the EPiServer Commerce project: EPiServer.Shell.dll, Lucene.Net.dll, Mediachase.Search.dll, Mediachase.Search.Extensions.dll, System.ComponentModel.Composition.dll
  3. Create a class with the attribute [SearchProvider] and implement the interface ISearchProvider, implement your own solution in the method:
    public IEnumerable<SearchResult> Search(Query query).
  4. When debugging remember to add the config (in red below) to the web.config of Commerce site, and deploy new dll to bin folder
  5. The default total result return when searching is 10 records.

<episerver.shell>
    <publicModules rootPath="~/modules/" autoDiscovery="Minimal">
      <add>
        <assemblies>
          <add assembly="EPiServer.Business.Commerce.Sample" />
              <add assembly="EPiServer.Business.Commerce" />
        </assemblies>
      </add>
    </publicModules>
    <protectedModules rootPath="~/cms/">
      <add>
        <assemblies>
          <add assembly="EPiServer.Business.Commerce.UI" />
        </assemblies>
      </add>
      <add />
    </protectedModules>
</episerver.shell>