Find 12.12

# Configure Templates

You can configure Find to use a custom template to display results and promotions in the search results list, and metadata in the preview panel. For example, you might want to use a larger thumbnail image and title in the result list, and to remove the summary.

You configure how Find uses the custom templates by using the `templates.json` configuration file, in the `customization` directory in your Find installation home directory. This configuration file contains JSON objects that allow you to configure different aspects of the Find results.

TIP: If you belong to the FindAdmin role, you can reload the template configuration to make any configuration changes available to your users without restarting Find.

To reload the template configuration, you must send the following API call to Find directly, by typing the URL into your Web browser address bar. You must be logged into Find as a user with the FindAdmin role in the same Web browser, because Find uses the session cookie to authorize the action.

    http://FindURL/api/admin/customization/config/reload

Where `FindURL` is the URL of your Find server.

This option also reloads any other customization configurations (for example, dashboards).

The following table describes the configuration objects that you can include in your template configuration file. These objects are all optional.

Object | Type | Description
--- | --- | ---
`searchResult` | Array | Defines the templates to use for search result items in the results list.
`promotion` | Array | Defines the templates to use for promotion items in the results list.
`previewPanel` | Array | Defines the templates to use for document metadata in the preview panel.
`entitySearch` | Array | Defines the templates to use for the entity search dialog box.

In each of these objects, you specify an array of template configurations, each of which specifies the template file to use and the circumstances in which to use the template.

The following table lists the configuration properties that you can use to specify a template.

Property | Required | Type | Description
--- | --- | --- | ---
`file` | Yes | String | The template file name. See Create Template Files.
`triggers` | Yes | Object Array | The triggers that specify when to use a template. This object can contain the following properties: `field` (string). Optional. The ID of a field that a document must contain for the trigger to activate. The ID is the key in the `fieldsInfo` section of the Find configuration file. You can optionally also specify `values` that this field must contain. `values` (array, strings). Optional. An array of field values that the specified `field` must contain for the trigger to activate. The field values are case sensitive. If you set `values`, you must also set `field`. `indexes` (array, strings). Optional. An array of IDOL databases that the document must come from for the trigger to activate. The index names are not case sensitive. When you set `field` and `values`, a document activates the trigger if it contains at least one of the specified values in the specified field. If the list of values is empty, a document activates the trigger if it contains any value in the specified field. When you set `indexes`, a document activates the trigger if it comes from one of the specified IDOL databases. You can specify multiple field conditions in the trigger array. In this case, a document must match all the specified field conditions to activate the trigger. Similarly, if you set both index and field conditions in a trigger, a document must match all the specified conditions to activate the trigger.

When displaying results, Find processes the templates in the order that you list them in the configuration file. For a particular document, Find uses the first template that the document matches. If there are no matching templates in your configuration, Find displays the result with the application default template.

The following example shows a simple search result configuration that applies to documents that contain the value Living people in the categories field, and that is in one of the PEOPLE, PERSONS or PERSON databases.

    {
       "searchResult": [
          {
             "file": "person.handlebars",
             "triggers": [
                {
                   "field": "categories",
                   "values": ["Living people"]
                },
                {
                   "indexes": " ["PEOPLE", "PERSONS", "PERSON"]
                }
             ]
          }
       ]
    }

© Copyright 2015-2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Find 12.12

Topic Title: Configure Templates