Pular para o conteúdo principal

SearchSelector

A Selector that provide methods to search for content. Only entry search is supported for the time being.

You can use a SearchSelector by accessing StarlightClient.search.

Index

Methods

Methods

entries

  • Returns a StarlightListResponse with a list of Entries. By default, entries from all models are returned, but filtering by model can be configured.

    @example

    Listing all entries in all workspace models.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.search.entries()
    @example

    Searching for “hello world” within all entries in all workspace models.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.search.entries({
    query: 'hello world'
    })
    @example

    Filtering the last example within specific models.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.search.entries({
    query: 'hello world',
    models: 'posts,videos,magazines'
    })

    Type parameters

    Parameters

    Returns Promise<StarlightListResponse<Entry<T>>>