Click or drag to resize

Indexing


The indexing system is how the CSAPI provides fast look-up and querying capabilities.

Built-in Indexing System

The Ingeniux CMS CSAPI uses a indexing system to query and search the Content Store quickly and efficiently.

The CSAPI comes with a list of indexes that its manager objects use. These indexes are stored in the Content Store. Indexing of content based on these indexes happens automatically when a ContentStore object is created. Therefore, it's important that the ContentStore object be created only once per app domain, to avoid repeated indexing in the background on the content server.

You can find the all the built-in indexes under the Ingeniux.CMS.RavenDB.Indexes namespace.

Custom Indexes

Built-in indexes provide all indexing needed for built-in manager objects. ITransactionalEntity provides a generic way to query for a specific index. This allows developers and integrators to create custom indexes to extend the CSAPI's querying capabilities.

There are two ways to create custom indexes:

  • Adding custom index classes directly to the CustomIndexes.cs file in the App_Data\xml\Custom\ directory

  • Creating plug-in DLLs to place in the App_Data\xml\Custom\Plugins\CustomIndexes directory

Custom index in the CustomIndexes.cs file

This is the quickest way to create a custom index. However, if you create an index this way, you may not have all the IntelliSense features Visual Studio provides. (This isn't a problem when you create an index as a plug-in, described in the next section.)

To create a custom index, add a new index class to the code file. Make sure it is well-formed. Save the file and recycle the app pool for the index to take effect.

Note that the custom indexes don't affect site startup. If a custom index is not compiled properly, it will be logged and bypassed. However, improperly compiled indexes affect Content Store indexing and performance.

Custom index as a plug-in

To create a custom index as a plug-in, you must create a class library project that can take advantage of all the IntelliSense and code documentation. This sort of index takes a little longer to set up, and the project's references will need to be maintained during major version upgrades.

To create a custom index plug-in project:

  1. Create a new class library project in Visual Studio 2013 or later. Make sure the project uses .NET 4.0 or later, but keep in mind that that .NET 4.5 and above are not supported in Windows Server 2003.

  2. You will need to add the following references to your project: Ingeniux.CMS.Common.dll, Ingeniux.CMS.CSAPI.dll, and Raven.Client.Lightweight.dll. All three assemblies can be found in the bin folder of the CMS site folder.

  3. Create your custom index class, referring to the code example provided in CustomIndexes.cs. Make sure it references the following namespaces:

    C#
    using Ingeniux.CMS;
    using Ingeniux.CMS.RavenDB.Indexes;
    using Raven.Client.Indexes;
  4. Compile your project and place the compiled assembly (only the project output itself; referenced assemblies are not needed) at the App_Data\xml\Custom\Plugins\CustomIndexes directory under the Ingeniux CMS site instance. Recycle app pool for the new index to take effect.

Note that the custom indexes don't affect site startup. If a custom index is not compiled properly, it will be logged and bypassed. However, improperly compiled indexes affect Content Store indexing and performance.

For further details on how indexing classes work and how to write them, please consult your trainers, or read the RavenDB documentation regarding static indexes at: Static Indexes Documentation