Sitecore Experience Platform

Build a search query

Abstract

Make accurate searches and limit your search results to the most relevant items.

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:

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 that are based on one or more of the other 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).

3FF81632F7744C64871C81D9D7711C5C.png

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.

    F3AFCD290F5F4A3F9182C7C88C0AEA96.png
  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.

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.

    EED71CFBF808425684BC2D753DE1AE62.png

    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.

    1F0CB90C970C4316A86BE5B5C4BD467E.png
  4. Press ENTER or click Search EEB3DB4E168D48A49C5A5DA4FB0F2DF5.png.

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.

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.

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.

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 9D1FFA72DBF844FB81C367CF27A4E200.png and must not contain 8AC936F2D3D247C9BD7405E212AD2F9E.png:

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

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

  • If your query contains both search filters that are marked with either 3689B3F5B52146A38638A0D91F36617F.png or BE6170669C1F49A09F05AAE330575B27.png 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.

6B03D7DD35954CFFA8B40624BE45FC91.png