Last updated

search

By default, search is added to your project in the top navigation bar in the far right side corner. You can use the search configuration to customize search in the following ways:

  • hide the search bar
  • add a list of shortcuts for activating search
  • add a list of suggested pages to the search modal

Options

OptionTypeDescription
enginestringSpecifies the type of search engine. Typesense requires an Enterprise or Enterprise+ plan. Possible values: flexsearch, typesense. Default: flexsearch.
hidebooleanSpecifies if the search bar should be hidden. Default: false.
shortcuts[string]List of keyboard shortcuts to activate search (for example, ctrl+f). Default: /.
suggestedPages[Page item]List of suggested pages.
filter[Filter item]Specifies advanced filter configuration.
ai[AI search options]Specifies AI search options.

Page item object

OptionTypeDescription
pagestringREQUIRED. Path to the file which represents the page to link to.
labelstringLink text displayed for the item.
labelTranslationKeystringLink text key for the item used for localization.

Filter item object

OptionTypeDescription
hidebooleanSpecifies if the search filter panel is hidden. Default: false.
facets[Facet item]List of user-defined search facets.

Facet item object

OptionTypeDescription
namestringREQUIRED. Name of the facet. It also acts as a label for the filtering control in the search dialog.
fieldstringREQUIRED. The ID of the facet. Use this ID as a key in metadata section when adding facets to the page.
typestringREQUIRED. Control displayed in the search dialog. The possible values are: multi-select (allows for selecting multiple filter values in the same facet), select (allows for selecting a single filter value in a facet), tags (applies only to the HTTP method facet).
isTopbooleanIndicates whether the facet is a top-level facet.

AI search options

The AI search feature is currently behind a feature flag. To request access to this feature, contact Redocly at team@redocly.com.

OptionTypeDescription
hidebooleanSpecifies if the AI search button is hidden. Default: true
promptstringText specifying the built-in instructions for the AI search. This prompt applies to all AI searches in the project and is not visible to the user. You can use this option, for example, to set a greeting, the tone of the answer, or any other conditions influencing the answer.

Examples

The following configuration hides the search bar.

search:
  hide: true

The following configuration sets keyboard shortcuts that trigger search:

search:
  shortcuts:
    - ctrl+f
    - cmd+k
    - /

The following configuration sets suggested pages for the search modal window:

search:
  suggestedPages:
    - label: Home page
      page: index.page.tsx
    - page: /catalog/

The following configuration displays the AI search button and sets the built-in prompt for the search:

search:
  ai:
    hide: false
    prompt: Speak only in rhymes

The following configuration overrides the default search facets:

search:
  filter:
    facets:
      - name: Category
        field: redocly_category
        type: multi-select
      - name: HTTP Method
        field: httpMethod
        type: tags
      - name: HTTP Path
        field: httpPath
        type: multi-select
      - name: API Title
        field: apiTitle
        type: multi-select
      - name: API Version
        field: apiVersion
        type: select
  • Explore the search facets configuration for detailed guidance on how to configure search facets.
  • Learn more about the options for adding translated content in the l10n reference documentation.
  • Find other options for adding items to the top navigation menu in the navbar reference documentation.

Resources