Shopify + Sanity: Read about the investment and partnership –>
Experimental feature

Studio search config

Define specific weights on fields/paths in the Studio

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).
  • 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?