Add new search filters and alias filters

The search filters describes how to use search filters to build queries. You can pick from a number of existing filters. Sitecore provides a number of search filters by default, but you have the ability to add more custom filters.

To add a new search filter:

  1. In the content tree, navigate to /sitecore/system/Settings/Buckets/Search Types. Sitecore recommends that you add new search filters in the User Defined folder.

  2. Select the User Defined folder, and on the Home tab, in the Insert group click Field Search Type. Give the new search type an appropriate name. This is the name that users enter in the search box to apply the filter.

    For example: if you name the search type Date, the user must type in Date: in the search box to apply the filter. The name is case sensitive.

  3. In the new search type item, in the Search Type section, in the Control Type field select the type of control that is most appropriate for your search.

  4. In the Display Text field, enter an appropriate text and ensure that the wording is consistent with all the other search filters. This text is displayed in the drop-down menu when users browse the search filters.

  5. If you want to apply a custom syntax to the Control Type field to create specific output., enter this in the Web Method field.

    For example, if the Control Type field is a calendar, the Web Method field can make a request to a web service to tell Sitecore to display a calendar control that only allows you to select a date from the last 2 calendar years.

Alias filters

Some field names are long and descriptive, and therefore not very easy to type into a search box.

You can create alias filters. These work as aliases for search fields with long names to make searching easier. For example, you could assign an alias to a field called Product Price, giving it the more searchable alias price. You can also add a slider control so users can slide between prices. The control type parameters for this slider are:

min:0&max:20000&value:40&range:true&start:0&end:2000

The default search filter

If no field is specified in the search filter, the search is run against a text field by default. The text field is defined at /sitecore/system/Settings/Buckets/Search Types/Text. The default value is _content,_name,_displayname and the search is run against all the text fields named _content and prioritizes matches with the Item name and the Item display name fields.

This filter is applied to Sitecore client content search, for example, on the Search tab, in the Multilist with Search field.

If you want to include other fields in the default Sitecore client search, you can edit the list.

Note

You can also use the <contentSearch.getGlobalSearchFilters> pipeline to add search result filtering for UI queries.

Do you have some feedback for us?

If you have suggestions for improving this article,