Coveo for Sitecore 5 is now available!

Inserting and Customizing a Related Query Component Using the Coveo for Sitecore Legacy Search UI Framework

Coveo for Sitecore (October 2016) Coveo for Sitecore 4.1 (November 2018)

The Related Query component is used to execute a query using its own filters, parameters, and modifiers and present its results next to the search results list.

  1. In the Content Editor, select your search page, and under the Publish tab, select the Experience Editor.
  2. Locate the coveo-recommendations placeholder in the right section of the search interface.
  3. Insert a Coveo Related Query component at the identified location by clicking the Add here label.

  4. In the Select a Rendering dialog box, select Coveo Related Query, and then click Select.
  5. In the Control Properties dialog box, enter your desired properties. Here are some properties you might want to change.
    1. Title: the name displayed for your tab.
    2. Bind to search interface: whether the component should be refreshed when a new query is done.
    3. Use the search interface current filters: whether the component should take the facet and tab filters into account. For this to work, Bind to search interface must be checked.
    4. Use the search interface current query: whether the visitor’s current query should be taken into account. For this to work, Bind to search interface must be checked.
    5. Under Paging: Number of results per page: Specifies the number of results to display. The default value is 10.
  6. For Enterprise clients, under Results scope, consider changing the Filter and Boosting expressions rules (see Adding Boosting or Filtering Expressions).

    For Free and Pro edition clients, see Using Boosting or Filtering Rules on the Tab Component Programmatically.

  7. Save the Control Properties dialog box by clicking on OK.
  8. Save your page.
  9. Validate that the related content appears in your search interface.

In your bookstore’s website, you want to have a related query component that presents authors related to the visitor’s current search.

You title the component Related Authors.

Because you want your Related Authors section to update with your visitor’s query, you decide to check the Bind to search interface and the Use the search interface current query, boxes in the Component Properties.

You also limit the items only to your items under the Authors item, by adding the rule where the item is the Authors item or one of its subitems under Results scope.

You save the page, and test your component by typing science fiction in the result box. You see that the component is updated with the query.

 

It is also possible to use the Related Query component directly on a page, without the Search Interface

  1. Insert the Coveo Search Resources component (see Inserting Coveo Search Components to an Existing Item).
  2. In the Sitecore Content Editor, select your item, and under the Publish tab, select the Experience Editor.
  3. Insert the component in your page.

    1. In the area where you placed your placeholder, select Add here.

      You might want to consider clicking the Add a new component button at the top of the page, next to the Save button.

    2. In the Select a Rendering dialog box, choose Coveo Recommendations, and click Select.

    3. In the Control Properties dialog box, enter your desired properties.

  4. Configure the properties as noted above (see step 5 in Inserting the Related Query Component in a Search Interface).

    In this scenario, you should never check the Bind to search interface option.

  5. Save your page.
  6. Validate that the component works as expected.

To learn more about the various properties of the Related Query component, see Related Query Component Properties.