Document Search

Our brand new Answers algorithm, Document Search, is the third component to our multi-algorithm story. Document Search allows consumers to search unstructured documents to return direct answers (via featured snippets) to their questions.

Backend Support

You can learn more about how to configure Document Search for your experience in this module.

Frontend Support

Answers Search UI v1.8.0 and Answers Hitchhiker Theme 1.20.0 include frontend support for document search.

Featured Snippets

Document search is able to pull out Answers to user’s questions from long bodies of text, in the form of featured snippets. To add featured snippets to your experience, you’ll take advantage of our new “documentsearch-standard” direct answer card.

  • If you’re creating a site from scratch, you won’t need to do anything.
  • If you’re upgrading from an older version of the theme, update the DirectAnswer component in your index.json file with the config in theme’s templates/universal-standard/page-config.json. This DirectAnswer component will reference the correct cards. Here’s what it will look like:
“DirectAnswer”: {
  “types”: {
            “cardType”: "documentsearch-standard"
        'FIELD_VALUE': {
            “cardType”: "allfields-standard"

Inline Snippets

Even if it doesn’t find a featured snippet, Document search will surface inline snippets, in the form of a snippet of text with highlighted values

To take advantage of inline snippets:

  1. Fork the card on which you’d like to add document search. For example, you might use the standard card.
  2. On the attribute where you’ll display the inline snippet, add the highlightField formatter:
details: profile.d_highlightedFields && profile.d_highlightedFields.s_snippet ? Formatter.highlightField(profile.d_highlightedFields.s_snippet.value, profile.d_highlightedFields.s_snippet.matchedSubstrings) : profile.body, // The text in the body of the card
  1. If the card has show more/show less, comment it out – the highlightField formatter returns HTML, so if you have show more/show less, it risks breaking the page
  2. Unescape the highlighted portion in your html.hbs file using triple brackets
<div class="HitchhikerStandard-detailsText js-HitchhikerCard-detailsText{{#if showExcessDetailsToggle}} js-hidden{{/if}}">

Note: This will also work for textSearch! Feel free to add it to any paragraphs where you’ve included text search.

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


Very cool! Excited to get this implemented

1 Like

Incredible that we can now get direct answers from unstructured, unorganized documents!