1. @sitecore-cloudsdk/search/server

SearchWidgetItem

Version:

Type

Class

Extends

ResultsWidgetItem

Import path

@sitecore-cloudsdk/search/server

A widget item for a search widget.

Constructor

SearchWidgetItem(
  entity: string,
  widgetId: string,
  searchOptions?: SearchOptions,
  sources?: ArrayOfAtLeastOne<string>
)

Parameters

Name

Type

Description

entity

string

Required.

The entity associated with the widget.

widgetId

string

Required.

The unique identifier of the widget.

To find the widget ID in Sitecore Search, click Widgets. Widget IDs are in the RFK ID column.

Example: "rfkid_7"

searchOptions

SearchOptions

Optional.

Options for the search widget item object.

Extends ResultsOptions, which lets you configure, for example, filters.

sources

string[]

Optional.

A list of source IDs that identify the sources to include results from. Useful for filtering results by source, for example, when managing multiple sites.

To find source IDs in Sitecore Search, on the menu bar, click Sources.

If set, the response will contain results only from the specified sources.

If unset, the response will return results from all sources.

Example: ["1062132", "1081839"]

Minimum length: 1.

Properties

Name

Type

Description

_facet

FacetOptions

The facet object of the search widget item. Contains facet settings for the search request. For example, how many individual facets to retrieve and in what order.

_query

QueryOptions

The query object of the search widget item. Settings related to the site visitor's search query.

_offset

integer

The number of items to skip in the results that are returned.

_sort

SearchSortOptions

Sorting configuration for search results.

_suggestion

SearchSuggestionOptions[]

The suggestion parameter of the search widget item. Used to configure search suggestions.

Minimum: 1.

_ranking

SearchRankingOptions[]

The ranking parameter of the search widget item. Used to configure search result ranking.

Minimum: 1.

_personalization

SearchPersonalizationOptions

Options for personalizing search results.

Accessors

The following properties are available to set:

get facet

get facet(): FacetOptions | undefined

Returns the facet property of the SearchWidgetItem instance.

set facet

set facet(facet: FacetOptions)

Sets the facet property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

facet

FacetOptions

The facet object of the search widget item. Contains facet settings for the search request. For example, how many individual facets to retrieve and in what order.

Errors

get query

get query(): QueryOptions | undefined

Returns the query property of the SearchWidgetItem instance.

set query

set query(query: QueryOptions)

Sets the query property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

query

QueryOptions

The query object of the search widget item. Settings related to the site visitor's search query.

Errors

get offset

get offset(): number | undefined

Returns the offset property of the SearchWidgetItem instance.

set offset

set offset(offset: number)

Sets the offset property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

offset

integer

The number of items to skip in the results that are returned.

Errors

get sort

get sort(): SearchSortOptions | undefined

Returns the sort property of the SearchWidgetItem instance.

set sort

set sort(sort: SearchSortOptions) 

Sets the sort property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

sort

SearchSortOptions

Sorting configuration for search results.

Errors

get suggestion

get suggestion(): ArrayOfAtLeastOne<SearchSuggestionOptions> | undefined

Returns the suggestion property of the SearchWidgetItem instance.

set suggestion

set suggestion(suggestion: ArrayOfAtLeastOne<SearchSuggestionOptions>)

Sets the suggestion property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

suggestion

SearchSuggestionOptions[]

The suggestion parameter of the search widget item. Used to configure search suggestions.

Minimum: 1.

Errors

get ranking

get ranking(): ArrayOfAtLeastOne<SearchRankingOptions> | undefined

Returns the ranking property of the SearchWidgetItem instance.

set ranking

set ranking(ranking: ArrayOfAtLeastOne<SearchRankingOptions>)

Sets the ranking property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

ranking

SearchRankingOptions[]

The ranking parameter of the search widget item. Used to configure search result ranking.

Minimum: 1.

Errors

get personalization

get personalization(): SearchPersonalizationOptions | undefined

Returns the personalization property of the SearchWidgetItem instance.

set personalization

set personalization(personalization: SearchPersonalizationOptions)

Sets the personalization property of the SearchWidgetItem instance.

Parameters

Name

Type

Description

personalization

SearchPersonalizationOptions

Options for personalizing search results.

Errors

Methods

resetFacet

Resets the facet property to undefined.

Signature

resetFacet(): void

Return value

Returns void.

resetQuery

Resets the query property to undefined.

Signature

resetQuery(): void

Return value

Returns void.

resetOffset

Resets the offset property to undefined.

Signature

resetOffset(): void

Return value

Returns void.

resetSort

Resets the sort property to undefined.

Signature

resetSort(): void

Return value

Returns void.

resetSuggestion

Resets the suggestion property to undefined.

Signature

resetSuggestion(): void

Return value

Returns void.

resetRanking

Resets the ranking property to undefined.

Signature

resetRanking(): void

Return value

Returns void.

resetPersonalization

Resets the personalization property to undefined.

Signature

resetPersonalization(): void

Return value

Returns void.

toDTO

Maps the SearchWidgetItem instance to its DTO (data transfer object) format.

Signature

toDTO(): SearchWidgetItemDTO

Return value

Returns the SearchWidgetItem instance in a standardized DTO format.

If you have suggestions for improving this article, let us know!