Search results

Description

The aceUISearch variant is intended to provide representations of contents as search results from the ACE Search Service.

Known clients

The following clients performs searches in the aceUISearch variant:

  • The Content Developer web application
  • The pContentSelect widget

Data output format

The output data is defined by type aceUISearchEntry which contain the following fields:

Field name Type Presence Description
title string mandatory Headline or title text
contentType string mandatory The type name of the content
text string optional The main text summary. Would typically be longer than the title, but should not be excessively long
author string optional The author of the content
thumbnailImageId string optional Content Id of a content hosting an image used to represent the content

Default composer

Along with the aceUISearchEntry type comes a default content composer identified by the alias _config/aceUISearch.DefaultComposer.

Unless already set by a project defined aspect mapper (or composer), the default composer sets the two mandatory fields title and contentType. The title field defaults to the content's main alias and the contentType field defaults to the type name of the content.

Note that the full alias, with it's prefix _config/, is not needed when referring to this composer from a variant since no other prefix is allowed (see example below).

Maven dependencies

The above mentioned type and default composer, along with some default variant configuration, is available through the ace-ui-types Maven artifact.

ACE content dependency:

<dependency>
  <groupId>com.atex</groupId>
  <artifactId>ace-ui-types</artifactId>
  <version>...</version>
  <classifier>ace-content</classifier>
</dependency>

Custom search result presentation

In most cases, the presentation provided by the default composer will not be sufficient. In order to have a rich search result presentation, custom Aspect mappers will have to be implemented for all searchable content types.

Example

A project may define a content type Article as:

{
    "system": {
        "contentType": "doc_example_content"
    },
    "aspects": {
        "doc_example": {
            "title": "Hello, world!"
        }
    }
}

An aspect mapper converting from the Article to aceUISearchEntry could then look like this:

function map(aspect) {
  var article = aspect.data;

  return {
    _type: 'aceUISearchEntry',

    contentType: 'Article',
    title: article.title,
    text: article.lead,
    thumbnailImageId: article.imageRef
  };
}

Note: The mapper must also be registered in the aceUISearch variant, see Variant Configuration for more information.