---
title: SQL search
related:
  - https://docs.kentico.com/k81/references/kentico-controls/cms-controls/sql-search-controls.md
  - https://docs.kentico.com/k81/custom-development/customizing-providers/creating-custom-sql-search-providers.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

The SQL search is an obsolete search engine for pages in the content tree of websites.

> **Note:** We highly recommend using the index-based [smart search](https://docs.kentico.com/k81/configuring-kentico/setting-up-search-on-your-website.md) instead.

The system continues supporting the SQL search for the following reasons:

- Backward compatibility with older versions
- Searching uncommon and legacy file types uploaded as page attachments

This search engine uses standard SQL queries to search for expressions:

- The system automatically generates search queries for the data of individual [page types](https://docs.kentico.com/k81/developing-websites/defining-website-data-structure/page-types.md). To override the search query for a page type, create a new query named **searchtree** in _Page types -> Edit page type -> Queries_.
- The **searchdocuments** query of the **Root** page type searches fields that are shared by all pages.
- The **searchattachments** query of the **Root** page type searches files uploaded as page attachments. To search attachments, you need to configure the system as described in [Configuring SQL search for attachment files](https://docs.kentico.com/k81/configuring-kentico/setting-up-search-on-your-website/searching-attachment-files/configuring-sql-search-for-attachment-files.md).

## Adding the SQL search onto your website

To integrate the SQL search into website pages, use the web parts in the **Full-text search** category (SQL search dialog, SQL search box, etc.) or the [CMSSearchDialog](https://docs.kentico.com/k81/references/kentico-controls/cms-controls/sql-search-controls/cmssearchdialog.md) and [CMSSearchResults](https://docs.kentico.com/k81/references/kentico-controls/cms-controls/sql-search-controls/cmssearchresults.md) server controls (in your ASP.NET code).

## Excluding pages from the search

To exclude pages from the SQL search, open the **Settings** application and select the **System -> Search** category:

- **Exclude page types from SQL search** - enter page type code names, for example _cms.article_.

  - You can enter multiple page types separated by semicolons (;).
- **Exclude pages from SQL search** - allows you to exclude entire website sections from the SQL search
  - To exclude a single page, enter the alias path, for example: _/news/news1_
  - To exclude entire website sections, enter a [path expression](https://docs.kentico.com/k81/developing-websites/loading-and-displaying-data-on-websites/loading-page-data/writing-page-path-expressions.md), for example: _/news/%_
  - You can enter multiple values separated by semicolons (;).

To directly exclude individual pages from the SQL search:

1. Open the **Pages** application.
2. Select the page in the content tree.
3. Open the **Properties -> Navigation** tab.
4. Check **Exclude from search**.
5. Click **Save**.

## Modifying the search result format

If you wish to change the format of the SQL search results:

1. Open the **Page types** application.
2. Edit () the **Root** page type.
3. Select the **Transformations** tab.
4. Adjust the **SearchResults** [transformation](https://docs.kentico.com/k81/developing-websites/loading-and-displaying-data-on-websites/writing-transformations.md).

## Developing custom search providers

If you need to integrate a custom search engine or make additional modifications to the search results returned by the SQL search engine, you can develop your own search provider. You can find more details in [Creating custom SQL search providers](https://docs.kentico.com/k81/custom-development/customizing-providers/creating-custom-sql-search-providers.md).
