- Creating and Making Use of a New Result Template
- Editing the Content of a Result Template
- Creating a Simple Listing Page
- Applying Filtering and Ranking Rules
- Routing Search Queries to Query Pipelines
- Inserting and Configuring a Global Search Box
- Inserting and Customizing a Distance Resources Component
- Configuring Custom Ranges for a Date Range or Numeric Range Facet
- Inserting Custom Components in an Existing Search Interface
- Integrate the Search Interface in an Existing Page
- Translating Fields to the Coveo Format
- Overriding Coveo for Sitecore Hive Initialization Options
- Creating a Custom Hive Component - Multi-Sort Tutorial
Inserting and Configuring a Global Search Box Using the Coveo for Sitecore Hive Framework
A global search box will be present on most, if not all of your pages and will redirect the search queries to the search interface.
Coveo for Sitecore Hive offers a Coveo Global Search Box component.
It can be used in and out of the search results page. This article explains how to use it in both scenarios.
For the search box to work properly, you need to include the Coveo Search Resources component on every page that will host the search box (see Coveo Hive Renderings List).
Scenario 1: Different Search Boxes in and out of the Search Results Page
The Coveo Search Interface component contains a placeholder for a Coveo Search Box. Inserting a search box in the search interface using that placeholder will connect the box to the the search interface and the results list within it.
However, you cannot use this local search box outside of the search interface, hence the need for two search boxes.
Inserting the Local Search Box
The local search box is a basic control on a search interface. If you have not done it already, follow the Getting Started Tutorial. If you have successfully completed the tutorial, you should have a search box in your search interface that drives the Coveo Results List.
Inserting the Global Search Box
In the page header of the pages that will have a global searchbox, except the one used to display the search results, insert a Coveo Global Searchbox rendering.
Create or select a data source for the Global Searchbox. Validate that the SearchPageUri parameter is set using the Coveo Edit Datasource button on the Global Searchbox.
You should now have a search box that redirects to the given search page URI. Once you reach the search results page, the local search box can be used for new queries.
Scenario 2: Same Search Box in and out of the Search Results Page
You might want to include a search box in the header of all of your pages which can also be used as the search box of a Search Interface.
To connect the global search box to the search interface in the results page, the search interface needs to understand that the search box is an external component. An external component is linked to the search interface without being inserted within one of its placeholders.
Inserting the Global Search Box inside of an External Component Section
To insert a Coveo Global Searchbox in multiple pages at a time, you might want to perform the component insertion instructions below by opening the
__Standard Values items of your relevant templates in the Sitecore Experience Editor. This way, all items based off of these templates will inherit the changes.
- Insert a Sitecore placeholder at the desired location in the applicable layout file.
In the Sitecore Content Editor, add the Coveo Search Resources and External Components Section components as available controls for the placeholder you have created.
- In the Sitecore Experience Editor, insert the Coveo Search Resources in your header placeholder.
- Insert the External Components Section rendering in your placeholder. This rendering is located in the Sections folder.
- Create or select a data source for the External Components Section (see Configuring the External Components Section).
- In the External Components Section, select the External Components placeholder and insert a new rendering.
Select the Global Search Section. This will add placeholders for you to insert the search box and related components.
- Select the Global Searchbox placeholder and insert a new rendering.
Select the Coveo Global Searchbox rendering.
- Create or select a data source for the Coveo Global Searchbox.
- Open the Coveo Global Searchbox data source and validate that the SearchPageUri parameter is set.
You should now have a search box that redirects to the given search page URI. Once you are on the search results page, new queries will reload the page. To avoid this behavior, you need to configure the External Components Section to tell the search interface that the search box is a local component.
Configuring the External Components Section
To configure the section, you need to edit the data source of the External Components Section.
- In the Sitecore Experience Editor, select the External Components Section.
In the External Components Section box, click the Edit Data Source button.
- Select the search interface data source that you want to bind the components to.
From now on, every component initialized within this External Components Section will behave as if it was inside this search interface.
The search box will be bound to the search interface if it is located on the same page, but will still act as a global searchbox if the search interface is not found.