Experimental feature

Studio search config

The global studio search panel (omnisearch) lets you search your content lake for any document that matches your term, or narrow down by filtering your query by schema types.

Hide documents from omnisearch

There may be instances where you don’t want specific documents from appearing in omnisearch.

To hide search results for a particular document type and remove it as a selectable filter:

{
  type: 'document',
  name: 'author',
  fields: [
    {name: 'name', type: 'string'},
    // ...
  ],
	// Hide all results for authors (and the author document type filter) in omnisearch
	__experimental_omnisearch_visibility: false,
  // ...
}

Some example use cases:

  • You have workflow-related documents that you don’t wish to expose editors to.
  • You want to hide documents that are less frequently used by editors.
  • You’re an author of a Sanity plugin that registers its own document schema and would prefer it doesn't appear in user's studios.

Protip

This only affects visibility within the global studio search (‘omnisearch’). Visibility in both reference and cross dataset reference input fields is unaffected.

Define custom weighting on fields

You can define specific weights on fields/paths for document types.

Since the API is not stable yet, and likely subject to change, it's configurable on the __experimental_search property for schema document types. Here's an example:

{
  type: 'document',
  name: 'author',
  fields: [
    {name: 'name', type: 'string'},
    // ...
  ],
  __experimental_search: [
    {weight: 1.2, path: 'name'}
  ]
  // ...
}

A few things to note:

  • The weight is a global multiplier across all document types, so if name on type customer has a weight of 2, and name on type author has a weight of 4, documents of type author will be ranked higher than documents of type customer, even if their name fields equally matches what the user searched for.
  • If no search config is specified on a document type, it gets derived from the preview config (which again is derived by default through schema introspection).
  • Only fields and paths included in __experimental_search will be used when determining search weighting. It acts as a search field allowlist and can be used as a way to ignore specific fields from search.
  • We have also united the reference search with the global search, so that they both follow the same ranking/weighting rules.

Was this article helpful?