Customizing how titles and thumbnails are displayed in the results

You can use the application customizer to change how document titles and URLs are presented in the results. You can also change URLs for thumbnail images and person thumbnail images.

About this task

Result filters can update the titles and URLs that are returned in the search results by replacing values in the title and URLs with information that you specify.

Procedure

To customize how titles and URLs are presented when users view results:

  1. In the application customizer, open the page for a user application, click the Title Filters or Thumbnail Filters tab, and select the tab for the type of filter to create.
  2. Click New and define one of the following types of filters:
    Field value
    If you select this option, you must specify the field name. When this filter is applied, the title or URL in the results is changed to the value of the specified field.

    For example, your collection contains reviews of computer accessories and you want to display a thumbnail image of the item that is discussed in each review. You create a field that is named itemURL and populate it with the URL of the corresponding image for each item. Then, you create a thumbnail filter to use the value in the itemURL field instead of the original thumbnail URL.

    Regular expression filter
    If you select this option, you must specify the regular expression formula to be applied. When this filter is applied, the title or URL in the results is changed according to the replacement values that you specify in the formula.

    You can also specify a field name for the regular expression filter. If the field name is specified, the value of the specified field is used as the target value to which the filter is applied. If a field name is not specified, the original title or URL is used as the replacement target.

    For example, the following title filter removes extensions from the file name:

    Field name: filename
    Formula: "/\..*$//"

    In the following document URL filter example, the filter searches for the pattern IBM_(.*)_ in the existing document URL, extracts the characters that match the (.*) portion of the pattern, and inserts the characters into the specified URL. For example, if the original document URL contains the characters _IBM_laptops_, the URL http://server.example.com/laptops.html is used in the results.

    Field name: (empty)
    Formula: "|IBM_(.*)_|http://server.example.com/$1.html|" ()

    In the following thumbnail URL example, a company crawled product information as individual documents, and the ID for each product is contained in a productId field. The company stores image files of the products on another server, and the URL of each image is in the format http://company.com/productId. In such a case, you can specify the following regular expression filter to display the correct thumbnail URL for each product.

    Field name: productId
    Formula: |(.*)|http://company.com/$1|

  3. Click Preview and run a query to verify that titles and URLs appear in the results with the replacement values that you specified.
  4. After you save your changes, apply the changes to your application by restarting the application or by restarting the Watson Explorer Content Analytics system.