Search results widget
Overview
You use the Search results widget to configure where and how to display the results of a search that a user performed on your website.
PREREQUISITES: You created at least one search index and added the Search box widget somewhere on your website.
For more information, see Create search indexes.
Configure the widget
To configure a widget, perform the following:
- In the page editor, hover over the widget.
- Click the toggle menu in the widget label.
- Click
(Edit).
Result list settings
- In Number of list items, select one of the following options:
- Use paging
This option divides the search results list in several pages. Each page contains up to 20 items. You can change the number of items per page. - Show limited number
This option displays a limited number of search result items. The default number of items is 20 in total. You can change the total number of items displayed. - Show all published items at once
This option displays all published items at once.
- Use paging
- Select how to sort the results.
Select between Most relevant on top, Newest first, and Oldest first. - In Allow users to sort results, select whether you want to display a sort box to enable users to change the default sorting behavior on the frontend.
Display settings
In Display setting section, you can do the following:
-
Change the template
To change the template that the Search results widget uses, select the new template in the Search results template dropdown boxYou must first have created a custom template.
For more information, see Next.js pages and templates. -
Configure the widget margins
In Margins, you can choose the margins between the text and the column where it is placed.
Choose from the predefined values of none, small, medium, or large.
Save your changes.
Advanced widget settings
To open the advanced settings, in the upper-right corner of the Search results page, click
(Advanced settings).
-
In Label, you can enter a specific name for this widget. This name will be displayed in:
- The page editor as a label for the widget
- In the treeview with the page structure in the right pane of the page editor.
-
In CSS class, you can enter individual CSS class for the Search results widget.
-
In Search fields, you can enter the fields that the search will search in.
NOTE: These fields must be included in the search index that you chose for this search box.
For more information, see Create search indexes.For example, if the search index includes News items, you can choose to search only in the
Title.If you leave the field empty, all fields are included in the index.
-
In Highlighted fields, enter the fields where the search terms will be highlighted.
NOTE: These fields must be included in the search index that you chose for this search box.
For example, if the index includes News items, and you enter
Titlefiled, the search term that the user enters, will be highlighted only in the titles of the news item, although the search may also return search results from the content.If you leave the filed empty, the search terms will be highlighted in all fields.
Labels and messages
In this section, you can configure the labels of the widget.
You can change the following labels:
- In Search results header, enter the text displayed above the search results.
For example, enterResults for "{0}" - In No results header, enter the text that will be displayed when the search returns no results.
For example, enterNo search results for "{0}" - In Results number label, enter the text that will be displayed after the number of results.
For example, enterresults - In Languages label, enter the text of the language selector.
For example, enterShow results in
Save your changes.