Understanding FeaturedSnippetDirectAnswer in Vertical Search Results

Hello,

I have been using the AnswersCore.verticalSearch method and when I get a directAnswer for a query, sometimes the type is FeaturedSnippetDirectAnswer. I saw in the docs that FeaturedSnippetDirectAnswer.value is optional but that FeaturedSnippetDirectAnswer.snippet field also has a nested value field and it is required. Can you explain the difference between the 2 fields and why FeaturedSnippetDirectAnswer.value is optional?

Thanks!

Hi Aaron,

Great question! For featured snippet direct answers, our document search algorithm will always return a snippet. When the identified answer is below a certain character count, it will also return a top level value. This can be used to further highlight the answer in your UI.

For example, take this featured snippet direct answer:


Here’s the API response for this example:

"directAnswer": {
  "type": "FEATURED_SNIPPET",
  "answer": {
    "snippet": {
      "value": "Embedded fields act as placeholders that can be added to text fields to dynamically display entity-specific content. For example, if you want to include specific geographic information in the business description for several entities, you can embed the city and state fields. Then, if you make changes to the city or state field, the information will dynamically update within the business description ...",
      "matchedSubstrings": [ ... ]
    },
    "fieldType": "multi_line_text"
  },
  "relatedItem": { ... }
},

Note that answer.snippet.value corresponds to the full block of text.

For this direct answer, on the other hand, we extracted a top level value, “once a month”:

The API response for this search returns:

"directAnswer": {
  "type": "FEATURED_SNIPPET",
  "answer": {
    "value": "once a month",
    "snippet": {
      "value": "Yext will automatically scan supported publisher sites once a month to identify potential duplicates, which you can take action on at any time. Note that if you are an Enterprise client and have the Managed Suppression service, your Yext Professional Services team will suppress duplicates for you in bulk, once a quarter ...",
      "matchedSubstrings": [ ... ]
    },
    "fieldType": "multi_line_text"
  },
  "relatedItem": { ... }
},

answer.snippet.value corresponds to the full block of text, whereas answer.value is that top level value.

Hope this helps!

Rose

1 Like

Ohhhh that makes sense. Thanks!