1. Classes

SearchWidgetItem

Version:
TypeClass
ExtendsResultsWidgetItem
Import path@sitecore-cloudsdk/search/browser

A widget item for a search widget.

Constructor

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

Parameters

NameTypeDescription
entitystringRequired.

The entity associated with the widget.
widgetIdstringRequired.

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"
searchOptionsSearchOptionsOptional.

Options for the search widget item object.

Extends ResultsOptions, which lets you configure, for example, filters.
sourcesstring[]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

NameTypeDescription
_facetFacetOptionsThe 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.
_queryQueryOptionsThe query object of the search widget item. Settings related to the site visitor's search query.
_offsetintegerThe number of items to skip in the results that are returned.
_sortSearchSortOptionsSorting configuration for search results.
_suggestionSearchSuggestionOptions[]The suggestion parameter of the search widget item. Used to configure search suggestions.

Minimum: 1.
_rankingSearchRankingOptions[]The ranking parameter of the search widget item. Used to configure search result ranking.

Minimum: 1.
_personalizationSearchPersonalizationOptionsOptions 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

NameTypeDescription
facetFacetOptionsThe 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

NameTypeDescription
queryQueryOptionsThe 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

NameTypeDescription
offsetintegerThe 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

NameTypeDescription
sortSearchSortOptionsSorting 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

NameTypeDescription
suggestionSearchSuggestionOptions[]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

NameTypeDescription
rankingSearchRankingOptions[]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

NameTypeDescription
personalizationSearchPersonalizationOptionsOptions 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!