The rendering behavior of the search results from a datasource are determined by 3 ways (in increasing order of preference):
- Default rendering behavior, based on the datasourceCategory (no further action required)
- Customized render config based on requirements (please contact glean support to set this up)
- Re-using the rendering configuration of another datasource (eg. gdrive)
Datasource categories are set for a datasource during the data source setup phase (or /adddatasource endpoint). The field is typically set for all custom data sources. For information on the meaning of each category, refer to this document: Selecting datasource category
With no further action required from the developer, we will aim to render results from the datasource of the specified datasource categories with information typically surfaced in results from that category.
We have specific default rendering behaviour for the following datasource categories:
For other categories, the rendering would be a vanilla icon + title + snippet (see screenshot below).
- The icon URL is fetched from the datasource config (as defined during the /adddatasource call (or) in the datasource setup page on workspace settings).
- The snippets are generated based on the relevance between the query and the provided body text.
- The title is provided in the title field while indexing documents.
Contact glean support to further customize rendering for your datasource (option 2).
Datasources with the above 2 categories, typically look like the following:
Currently, this step requires contacting glean support to get the behaviour support.
Examples of requests include:
- I need a custom list of attributes to show up in the ‘meta line’ (ie. the line below the title)
- I need a different icon to show up for different object types
For now, this will be setup by Glean internally - but in the future we expect to enable admins/developers to configure this themselves via the Glean workspace settings.
Here is an example of customized rendering for a search result:
The example above is for an internal job portal datasource and shows how we can add custom attributes like level, location, job role, engineering manager (as a person field).
To do this, you can set the renderConfigPreset in the datasource config (when making /adddatasource calls or setting up a datasource via the workspace settings).
This field can be set to the name of any datasource supported by glean (in lower case). While it is recommended to contact Glean support to help get this setup - some of the common values used for this field include:
If you want to go back to using the default rendering behaviour (option 1) OR the custom rendering setup through option 2, you must unset the renderConfigPreset in the datasource config.