Federated Search Schema

Last updated on
19 December 2018

Because our data is served by an external application, all sites will need to conform to a set field schema when sending data to the index. Extra fields may be sent for use by individual sites, but they will not be read by the React app.

Expected schema

  • Values in the Label column values aren't sent to the index, but are recommended for consistency
  • The Machine Name and Type column values are sent to the index, and must match the table in order for a site's content to be included correctly in results
Label Machine Name Type Required? Single/ Multi-value Token (example) Description
Federated Title federated_title string Yes single The title of the item. Displayed as the title of each search result.
Federated Date federated_date date No single [node:created:custom:Y-m-d\TH:i:s\Z] Usually the date the content was created. Used to provide date-based filtering.
Federated Type federated_type string Yes single The shared type label for faceting. Also used to label each result.
Federated Terms federated_terms string No multi Terms for additional, topic-based facets, mapped to shared topic terms if necessary.
Federated Image federated_image string No single D8: [node:field_image:search_api_federated_solr_image:url]
D7 (see instructions below): [node:field_image:search_api_federated_solr_image]
An absolute url to an image which, if it exists, will be displayed with the text. The module provides an image style using recommended dimensions.
Rendered HTML output rendered_item fulltext Yes multi The full text of the item, with HTML stripped.
URIs urls string Yes multi The absolute path to the item, used to provide a link to each result. This is sent as multivalue as Domain-enabled sites may provide multiple links to a single piece of content.
Site Name site_name string Yes single The descriptive name of the source site. Used to provide site-based filtering.
Site site string Automatic single The base url of the source site, like https://mysite.com. This will be sent automatically by Drupal, and is required for external content sources.

Configuration details

  • Federated Date: This date must be in YYYY-MM-DDThh:mm:ssZ format (as per the Solr spec) to be used in date-based facets. Drupal's modules may automatically do this conversion, or you can use the custom token as above.
  • Federated Type: This should be mapped to a standard set of types. For example: PagePeopleNewsEventsLocations, and Multimedia
  • Federated Image: Do not provide the URL to an original image, since these may be large files. Instead, provide the url to the image with a Drupal Image Style applied. Unlike Drupal, the Federated Search application won't have the ability to resize images before sending them to visitors, and using the full-size file could slow down the results pages for visitors.
    • Drupal 8 core has the ability to generate direct urls with image styles using the token as listed above.
    • In Drupal 7, the Imagecache Token module can assist with generating these tokens. Download and install the module, visit admin/config/media/imagecache-token to ensure functionality is enabled for any File or Media fields, then in the Token list on the Mapped Field config you should be able to use tokens as listed above.
  • Rendered HTML output:
    • Use the rendered_item field provided by Search API (found in the index configuration under Add fields > General > Rendered HTML output), then select a view mode for each indexed entity type. Often the "Default" view mode will work; otherwise, you may need to create a custom "Search Index" view mode and configure the fields for each indexed entity type and bundle.
      • Make sure that the Rendered HTML output includes the title/label for the entity, if the title should be available for full-text search and should impact the relevance of results.
    • Strip HTML from this data by enabling the HTML filter in the "Processors" tab of your index configuration.
  • URIs: Use the urls field provided by Search API in the index configuration under Add fields > General > URINote: Without applying a patch, this field provides a relative URL instead of the required absolute URL.
  • Site Name: Use the site_name field provided by this module (Search API Field Map/Federated Solr depending on version), found in the index configuration under Add fields > General > Site Name.
  • Site: This will be sent automatically; you do not need to configure a site field for your Search API index.

Example: A site with page, blog post, and user profile content

Label Machine Name Source
Federated Title federated_title
  • Page, blog post: use the node title
  • Profile: use the content's "Display Name" field.
Federated Date federated_date
  • Page, profile: no value
  • Blog post: publishing date
Federated Type federated_type
  • Page: Page
  • Blog post: News
  • Profile: People
Federated Terms federated_terms
  • Page: no value
  • Blog post: tags, mapped to shared terms
  • Profile: specialties tags, mapped to shared terms
Federated Image federated_image
  • Page, blog post: use the content's "Featured Image" field.
  • Profile: use the content's "Profile Photo" field.
Rendered HTML output rendered_item
  • Page, blog post, profile: render using "Default" view mode
URIs urls Use Search API's "URIs" index field.
Site Name site_name Use this (Search API Federated Solr) module's "Site Name" index field.

Help improve this page

Page status: No known problems

You can: