---
title: Smart search syntax
---

> 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).

> **Note:** **Important**: The information on this page applies to searches made using [locally stored indexes](https://docs.kentico.com/13/configuring-xperience/setting-up-search-on-your-website/using-locally-stored-search-indexes.md). If you are using [Azure Search](https://docs.kentico.com/13/configuring-xperience/setting-up-search-on-your-website/using-azure-cognitive-search.md) indexes, refer to the [Simple query syntax](https://docs.microsoft.com/en-us/rest/api/searchservice/simple-query-syntax-in-azure-search) and [Lucene query syntax](https://docs.microsoft.com/en-us/rest/api/searchservice/lucene-query-syntax-in-azure-search) articles to learn about the supported syntax options.

Users can submit advanced search expressions using the Lucene query parser syntax. You can find detailed information at:\
<http://lucene.apache.org/core/old_versioned_docs/versions/3_0_3/queryparsersyntax.html>

To allow the advanced syntax, choose one of the following levels of supported syntax for your search requests:

- **None** – the search does not recognize any Lucene query syntax. The system processes all text entered by users as a part of the search expression.
- **Basic** – the search recognizes all query syntax, _except for field searching_.
- **Full** – the search processes all search query syntax, including field searching.

Developers can adjust the level in the search code via the [SearchParameters object](https://docs.kentico.com/13/configuring-xperience/setting-up-search-on-your-website/using-locally-stored-search-indexes/building-a-search-interface-for-local-indexes.md) (the _Basic_ syntax level is used by default).

The system only processes advanced query syntax correctly for search requests that use the **Any word** [Search mode](https://docs.kentico.com/13/configuring-xperience/setting-up-search-on-your-website/using-locally-stored-search-indexes/configuring-search-assistance-features-for-local-indexes.md). Other search modes may interfere with the syntax. For example, using the OR boolean operator contradicts the _All words_ search mode.

> **Info:** **Search syntax errors**
>
> If you allow advanced search expressions, a parsing error occurs if a user enters the query syntax incorrectly.
>
> By default, syntax errors cause the search to show the standard "No results" message, and the system enters the error into the application's [Event log](https://docs.kentico.com/13/developing-websites/troubleshooting-websites/working-with-the-system-event-log.md).

## Field search

Field searching allows users to define additional conditions in search expressions. All conditions must start with either the + or - symbol. The + symbol indicates that only results which fulfill the field condition should be returned. The - symbol has the opposite meaning, only results that do **not** contain the specified value in the given field are retrieved.

**For example:**

- +network +NewsReleaseDate:\[20080101 TO 20091231]

When searching for this expression using a page index, the smart search returns only news pages containing the word _network_, released in the year 2008 or 2009.

> **Note:** **Field search requirements**
>
> Field search only works for fields that have the **Searchable** option enabled in the **Local** search field configuration of the searched object type. If there is no field name specified before a value in the search expression (such as the word _network_ in the example above), the system searches the index fields marked as **Content**.

It is also possible to perform direct field searches without any standard content keywords. This allows users to find records simply by entering an exact field value:

- _DocumentNodeID:(int)17_ – returns the page with a nodeID equal to _17_.
- _NewsTitle:"New features"_ – returns the news page titled _New features_.
- _SKUDepartmentID:(int)4 OR (int) 6_ – returns all products that belong to one of the specified departments (with an ID of either _4_ or _6_).

> **Tip:** **Tip**: Using field search queries provides a great deal of flexibility, but is not convenient for regular website visitors. If you wish to allow users to limit the scope of searches through conditions on the live site, we recommended building filters as part of your [search interface](https://docs.kentico.com/13/configuring-xperience/setting-up-search-on-your-website/using-locally-stored-search-indexes/building-a-search-interface-for-local-indexes.md).

### Searching text fields

When searching in text fields, you do not need to specify the type of the value. However, keep in mind the following when searching for values containing **spaces**:

- Search values containing one or more spaces must be enclosed in quotes, for example: _NewsTitle:"New features"_
- Text fields must have the **Tokenized** option enabled in the **Local** field configuration of the searched object type in order for the search to find matches for values containing spaces.

### Searching numeric fields

When performing field searches, the values specified are processed as strings by default. If you are searching in **Integer**, **Floating-point (double)** or **Decimal** type fields, you need to explicitly specify the data type of values in the search syntax:

- NewsID:\*\*(int)\*\*22
- SKUPrice:\*\*(double)\*\*255.0
- DecimalField:\*\*(decimal)\*\*9.99
- DocumentNodeID:\[\*\*(int)\*\*1 TO \*\*(int)\*\*100]

### Searching date and time fields

Use the following syntax to search in DateTime fields: **:yyyymmddhhmm**.

For example:

- DocumentCreatedWhen:200812230101
- DocumentCreatedWhen:\[200902020101 TO 200906020101]

### Field search with Stop and Simple analyzers

Indexes created by Stop and Simple analyzers cannot be searched using the standard field search format. This is by design, but you can use a workaround with a range query containing identical boundaries:

- newsid:\[(int)22 TO (int)22]
