Add control over including embeds in search response in ContentSearch and ContentPicker #396
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Description of the Change
This PR allows for control over whether the search results in the
ContentSearchcomponent should include embeddings in the response via the newincludeEmbedsprop and passes thatembeddedobject through theNormalizedSearchResultsto therenderItemandrenderItemTypefunctions.This allows for greater customization of the search results than what is currently provided in the normalized results without needing to perform additional API requests. This allows any standard field included in an embedded response to be used, enabling things like showing the publish date for instance.
The ContentSearch and ContentPicker components have been updated to accept the
includeEmbedsprop, as well as theQueryArgsinterface. Both thecontent-search-exampleandcontent-picker-exampleblocks have been updated to demonstrate result customization.Here is the content search example that has been updated to include the post date:
Note that
_embed: trueis currently part of the post search query but the embeds are not passed through, both becausenormalizeResultsdoes not currently process it but also because the fields requested don't allow for_linksand_embeddedin the response. This change controls both of these aspects, and by default does not include embeds.Closes #395
How to test the Change
includeEmbedsis not passedChangelog Entry
Credits
Props @cr0ybot
Checklist:
I'm opening the PR for review because I'm admittedly new to cypress and I'm not sure how to run the integration tests, but the tests have been updated (I don't think they would have been working before).