Kentico provides an index-based search engine (Smart search), which allows users to search through the content of websites and various types of data within the system. The smart search is based on Lucene.Net (version 3.0.3) — a source code, class-per-class, API-per-API port of the Java Lucene search engine to C# and the .NET platform.
The smart search uses indexes to store information about the website content. When a user sends a search request, the system searches through the appropriate indexes, which results in significantly better performance compared to linear SQL query search.
To set up the smart search functionality on your website, you need to perform the following steps:
- Enable smart search indexing in the system.
- Create search indexes. Assign the indexes to your site and define their exact content.
- Add smart search web parts onto the pages of your website. To learn more about the web parts, see Adding search functionality to pages and Using search filters.
If you have upgraded an existing instance of Kentico to version 8, see Upgrading to Kentico 8 - Smart search for additional instructions.
How the smart search works
The system stores the content of smart search indexes in physical index files on the server's disk. The index files are located in the ~/App_Data/CMSModules/SmartSearch/<Index code name> folder within your web project directory.
Documents, forums and other Kentico objects are reflected in the index file as index documents. The data structure of the index documents is suitable for being searched, resulting in significantly higher search performance compared to linear SQL search.
The index documents contain the same fields as the corresponding Kentico objects, based on the. Depending on these settings, the Index writer creates representations of objects in the index files. When an object included in the index is created, removed or has one of its fields modified, the system automatically schedules an Indexing task, which updates the corresponding index document. The Index searcher searches through the index file and returns relevant results.
You can find a list of all indexing tasks that are waiting to be processed in Smart search -> Tasks. Here you can:
- Look for information if you encounter problems with new content not being indexed correctly
- Delete () tasks from the indexing queue to stop unnecessary or problematic indexing
See also: Monitoring search indexing tasks
The following model scenario explains the life cycle of a document in a search index file:
- A user creates a new document.
- Upon the document's creation, the system logs a new indexing task in the database.
- The Smart search either runs the indexing task immediately or processes it later using a scheduled task.
- When executed, the indexing task adds the new document to the appropriate search indexes. The system indexes the document's content based on the search field settings defined for the given document type.
- A user arrives on the website and sends a search request via a Smart search web part.
- The web part searches through the assigned indexes and returns results based on the found data.