Direct Answers on Vertical Search (Summer '21 Release)

Users can now see direct answers in vertical experiences outside of universal search. For example, direct answers on vertical search allows a user to search for a location’s phone number on a Maps vertical search and have the phone number show up. We’ve designed these direct answers to return from vertical search the same way they would return from universal search.

A future version of the Theme will have direct answers built into the UI by default.

To add a Direct Answer on a vertical search page, you will need to:

Add the DirectAnswer configuration to your config.json file for that page

 
  "componentSettings": {
    "DirectAnswer": {
      "types": {
        "FEATURED_SNIPPET": {
          "cardType": "documentsearch-standard"
        },
        "FIELD_VALUE": {
          "cardType": "allfields-standard"
        }
      }
    },
//other components here
}

Add the DirectAnswer and Direct Answer cards partial to your html.hbs page. This can reference the universal page partial

{{#> layouts/html }}
  {{#> script/core }}
    {{> cards/all }}
    {{> directanswercards/all }}
    {{> templates/universal-standard/script/directanswer }}
//etc

Below the spell check partial, add the direct answer partial

{{> templates/vertical-standard/markup/spellcheck }}
{{> templates/universal-standard/markup/directanswer }}
{{> templates/vertical-standard/markup/verticalresults }}
{{> templates/vertical-standard/markup/pagination }}

You may also need to add some custom CSS to handle some of the layout.

:spiral_calendar: This feature is available in Early Access. Here’s how to use the Early Access branches of the Theme and SDK!