Introducing the Smart Search Engine with Kentico CMS 5
Search is an important component of website usability. Providing the content and information a user is searching for quickly and easily is an important part of any web site. Within Kentico CMS 5 this functionality is provided by the Smart Search Engine. This engine takes advantage of the Lucene.NET Search Engine (Version 2.10). The Lucene Search Engine is an algorithmic port of the Java Lucene search engine to the C# and .NET platform. In this post we will look at the basics of the Smart Search engine and how it can be enabled with Kentico CMS 5.
The Lucene Engine provides the Kentico CMS Smart Search Engine a set of indexes that store information about the content of a site. Documents and forums are reflected in theses index file as index documents. The data structure of the index documents are designed for significantly higher search performance than a linear SQL search. Search requests use the index instead of having to make a database request. As you can guess this provides a significantly better performance compared to SQL query search.
Note: The SQL Server Search Engine has been an integral part of Kentico CMS. While still available in Kentico CMS 5, it should be used for backward compatibility
The Smart Search Engine is enabled in Site Manger Settings Web site and selecting the Enable smart Search indexing as shown below.
Once enabled, the index files created by the Smart Search Engine are located in the ~/App_Data/CMSModules/SmartSearch directory as shown below. By default there are two index types. The first is a document index that contains the content of documents in the content tree. The second is a forum index that stores the content of discussion forums.
Indexes are maintained within CMS Desk Administration Smart Search as shown below.
When a document is saved to the database a new indexing task is logged. The Smart Search Engine automatically checks the database looking for these tasks. When a task is found the Smart Search Engine processes the page and adds the relevant information to the index. By default the indexes contain the document type fields. For example, shown below is the default document properties list for the Article Document Type. When a new article is added the index writer uses these fields to update the index.
Requests made with the Smart Search web parts shown below are automatically passed to the Smart Search module. This module calls the index searcher which processes the index files checking the relevant document fields and returns the results.