Build a search query

Current version: 9.3

Because your Sitecore website can contain thousands of items, it is important to know how to make accurate searches and limit your search results to the most relevant items.

In Sitecore, you can run a simple search or build complex search queries. You can search using a single search query, or you can combine multiple queries to limit your search results. You can enter as many search filters and keywords as you need.

This topic outlines how to:

Search with the default 'or' logic

When you enter more than one search filter or keyword, the search uses the ‘or’ logic by default. This means that the search returns items based on one or more filters or keywords.

For example, if you apply a filter for version 2 and a filter for the Japanese language in the search query, your search results will return items that have a version 2 or items that are in Japanese (or both).

The Search tab with filters for version 2 and Japanese language.

Search with predefined search options

To ease the everyday work in Sitecore, the search functionality collects information on your recent search activity and the recently created or modified items. If you use these predefined search options, you can quickly get to the items that you regularly work on in the Content Editor, regardless of which item is selected in the content tree.

The predefined search options include:

  • Your recent searches

  • Recently modified items

  • Recently created items

  • Your recently opened tabs

Note

Your Sitecore administrator can customize the default options that are available in the drop-down menu.

To open items from a predefined search option:

  1. Click the drop-down arrow on the left side of the Search field.

  2. Expand one of the search options to see a detailed list of the items that are listed for that specific search option.

    The Search tab with the list of recent searches expanded.
  3. Click the link to an item to open it in a new tab in the editing pane.

    If you click a search query under My Recent Searches, the query is inserted in the search field and you can run the search by clicking the search icon. You can enter more than one search query from My Recent Searches.

Search with predefined search filters

To limit the search results, you can insert one or more predefined search filters into the search field.

To use search filters:

  1. Click the drop-down arrow on the left of the Search field.

  2. Expand the Search Filters option and select the required filter.

    The Search tab with the list of search filters expanded.

    The filter is inserted into the Search field followed by a colon.

  3. After the colon, enter the search keyword for the filter. Sitecore auto-suggests the text or prompts you to enter a date. You must enter 1-3 characters before Sitecore makes any suggestions.

    The list of suggested searches below the Search field.
  4. Press ENTER or click Search .

Note

Once you get familiar with the syntax for the different searches, you can type the search filter directly into the Search field, for example author:, template:, or start:. Sitecore auto-suggests the text or prompts you to enter a date.

Search with wildcards and replacements

To help you search in Sitecore, you can use wildcards and replacements. Sitecore supports the following symbols and you can use them in a basic search or within a predefined search filter as needed:

  • Quotation marks, for example, “text” – searches for an exact word or phrase.

  • The * symbol – finds every form of a word. You can use the symbol inside a word, at the beginning or end of a word, or a combination of this. For example:

    • Searching for econom* will find "economy", "economics", “economical", and so on.

    • Searching for *graph* will find “paragraph”, “paragraphing”, “graphic”, and so on.

    • Using * by itself brings up all items within the item you have selected.

  • The ? symbol – replaces any single character, either inside the word or at the beginning or end of the word. For example:

    • Searching for "t?re" will find "tire", "tyre", "tore", and so on.

Search within a range

If you need to search within a range, Sitecore supports both numerical and text range searches.

For example:

  • price:[400 TO 500]

  • title:[algeria TO bahrain]

Note

A developer can add a slide control with a predefined range, which makes it easier for you to see and search within the accepted range.

Combine ‘and’ and ‘not’ in a search query

To perform complex searches for items that, for example, must contain or must exclude specific words, you must use ‘and’, ‘or’, and ‘not’ to combine the search filters in the query.

When you enter a filter in the search field, you can click the icon for the search filter and toggle between must contain and must not contain :

  • If you select , the items that the search returns must contain the value in the search filter.

  • If you select , the items that the search returns must not contain the filter value.

  • If your query contains both search filters that are marked with either or and search filters that are not marked, the search filter with no marking determines which items are listed at the top of the search results.

For example, in the following screenshot, the search results must have the text ‘new’ in the content, the results cannot be in the English language, and the items written by the sitecoreadmin user are listed at the top of the search results.

The Search tab with one include filter, one exclude filter and one regular filter.

Do you have some feedback for us?

If you have suggestions for improving this article,