Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely CMS
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Table of contents

EPiServer.Construction.ContentFactory can be used.

Using PageProviderBase for Implementation

Each class that is registered with EPiServer CMS as a page provider must inherit the class EPiServer.Core.PageProviderBase that resides in assembly EPiServer.dll. The base class contains some abstract methods that must be implemented, for example, GetLocalPage, ResolveLocalPage etc. The base class also contains some virtual methods that can/need to be overriden if some capabilities are to be supported, see the Configuring Content Providers section.

The base class also offers some helper methods to work with PageData objects. One such method is InitializePageData which initializes a PageData object with metadata properties and properties given by the specified page type it also set some default values on metadata properties. Another method is SetProperties that set values for properties on a PageData object. Yet another helpful method is GetProperties that extracts data from a PageData object to a Dictionary so it can be passed/stored to some other back-end storage.

Searching a Content Provider Instance

If a content provider instance is to be searchable, it must be registered with the Search capability and the class registered must implement FindPagesWithCriteria if it inherits PageProviderBase or implement IPageCriteriaQueryService if it inherits ContentProvider.

Below is a description on how to call FindPagesWithCriteria depending on which content providers is to be included in the search.

Specific Search on a Specific or Many Custom Content Providers

Searching on a specific Custom Content Provider or even many Custom Content providers is done by adding a PropertyCriteria for each Custom Content Provider to PropertyCriteriaCollection.

Name the property EPI:MultipleSearch and the value should be the name of Custom Content Provider. Example:

C#
PropertyCriteriaCollection crits = new PropertyCriteriaCollection();
       PropertyCriteria crit = new PropertyCriteria();
           crit.Name = "EPI:MultipleSearch";
           crit.Value = "CustomKey";
             DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);

Search on All Custom Content Providers

Searching on all Custom Content providers can be achieved be by defining only one PropertyCriteria. The name of the PropertyCriteria should be EPI:MultipleSearch and the value should be "*". Example:

C#
PropertyCriteriaCollection crits = new PropertyCriteriaCollection();
PropertyCriteria crit = new PropertyCriteria();
crit.Name = "EPI:MultipleSearch";
crit.Value = "*";
DataFactory.Instance.FindPagesWithCriteria(customPageRef, crits);

Search on Default Content Provider

Search on default content provider is typically the one serving content from the EPiServer CMS database. The Searching will work as before if there is not PropertyCriteria with the name EPI:MultipleSearch.

Full text search is implemented only for the default Content Provider. This means that content served by custom content providers are not indexed and will not be searchable by using EPiServer SearchDataSource control.

A Remote Page Provider is used to integrate the content between two installations of EPiServer CMS. Pages appear as any local page even when they are managed by a separate installation.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Mar 25, 2013

Recommended reading