---
title: "SearchWidgetItem"
slug: "cloud-sdk-search-searchwidgetitem"
abstract: "The SearchWidgetItem class represents a widget item for a search widget."
---
# SearchWidgetItem

|     |     |
| --- | --- |
| Type | Class |
| Extends | `ResultsWidgetItem` |
| Import path | `@sitecore-cloudsdk/search/browser` |

A widget item for a search widget.

## Constructor

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

### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `entity` | `string` | Required.<br><br>The entity associated with the widget. |
| `widgetId` | `string` | Required.<br><br>The unique identifier of the widget.<br><br>To find the widget ID[^UUID-101b62f6-b640-ed11-1057-29646ebb9fb7_N67248fcfc8b58] in Sitecore Search, click **Widgets**. Widget IDs are in the **RFK ID** column.<br><br>Example: `"rfkid_7"` |
| `searchOptions` | [`SearchOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-searchoptions.html "SearchOptions") | Optional.<br><br>Options for the search widget item object.<br><br>Extends [`ResultsOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-resultsoptions.html "ResultsOptions"), which lets you configure, for example, filters. |
| `sources` | `string[]` | Optional.<br><br>A list of source[^UUID-101b62f6-b640-ed11-1057-29646ebb9fb7_N6762bd56030ee] IDs that identify the [sources](https://doc.sitecore.com/search/en/users/search-user-guide/en/identify-the-required-source-type.html) to include results from. Useful for filtering results by source, for example, when managing multiple sites.<br><br>To find source IDs in Sitecore Search, on the menu bar, click **Sources**.<br><br>If set, the response will contain results only from the specified sources.<br><br>If unset, the response will return results from all sources.<br><br>Example: `["1062132", "1081839"]`<br><br>Minimum length: 1. |

## Properties

| Name | Type | Description |
| --- | --- | --- |
| `_facet` | [`FacetOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-facetoptions.html "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`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-queryoptions.html "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`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-searchsortoptions.html "SearchSortOptions") | Sorting configuration for search results. |
| `_suggestion` | [`SearchSuggestionOptions[]`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/cloud-sdk-search-searchsuggestionoptions.md "SearchSuggestionOptions") | The suggestion parameter of the search widget item. Used to configure search suggestions.<br><br>Minimum: `1`. |
| `_ranking` | [`SearchRankingOptions[]`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/cloud-sdk-search-searchrankingoptions.md "SearchRankingOptions") | The ranking parameter of the search widget item. Used to configure search result ranking.<br><br>Minimum: `1`. |
| `_personalization` | [`SearchPersonalizationOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/types/cloud-sdk-search-searchpersonalizationoptions.html "SearchPersonalizationOptions") | Options for personalizing search results. |

## Accessors

The following properties are available to set:

### get facet { .notintoc }

```typescript
get facet(): FacetOptions | undefined
```

Returns the `facet` property of the `SearchWidgetItem` instance.

### set facet { .notintoc }

```typescript
set facet(facet: FacetOptions)
```

Sets the `facet` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `facet` | [`FacetOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-facetoptions.html "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 { .notintoc }

- [`IV-0014`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

### get query { .notintoc }

```typescript
get query(): QueryOptions | undefined
```

Returns the `query` property of the `SearchWidgetItem` instance.

### set query { .notintoc }

```typescript
set query(query: QueryOptions)
```

Sets the `query` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `query` | [`QueryOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-queryoptions.html "QueryOptions") | The query object of the search widget item. Settings related to the site visitor's search query. |

#### Errors { .notintoc }

- [`IV-0009`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

### get offset { .notintoc }

```typescript
get offset(): number | undefined
```

Returns the `offset` property of the `SearchWidgetItem` instance.

### set offset { .notintoc }

```typescript
set offset(offset: number)
```

Sets the `offset` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `offset` | `integer` | The number of items to skip in the results that are returned. |

#### Errors { .notintoc }

- [`IV-0026`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

### get sort { .notintoc }

```typescript
get sort(): SearchSortOptions | undefined
```

Returns the `sort` property of the `SearchWidgetItem` instance.

### set sort { .notintoc }

```typescript
set sort(sort: SearchSortOptions)
```

Sets the `sort` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `sort` | [`SearchSortOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-searchsortoptions.html "SearchSortOptions") | Sorting configuration for search results. |

#### Errors { .notintoc }

- [`IV-0026`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

### get suggestion { .notintoc }

```typescript
get suggestion(): ArrayOfAtLeastOne<SearchSuggestionOptions> | undefined
```

Returns the `suggestion` property of the `SearchWidgetItem` instance.

### set suggestion { .notintoc }

```typescript
set suggestion(suggestion: ArrayOfAtLeastOne<SearchSuggestionOptions>)
```

Sets the `suggestion` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `suggestion` | [`SearchSuggestionOptions[]`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/cloud-sdk-search-searchsuggestionoptions.md "SearchSuggestionOptions") | The suggestion parameter of the search widget item. Used to configure search suggestions.<br><br>Minimum: `1`. |

#### Errors { .notintoc }

- [`IV-0014`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")
- [`IV-0016`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

### get ranking { .notintoc }

```typescript
get ranking(): ArrayOfAtLeastOne<SearchRankingOptions> | undefined
```

Returns the `ranking` property of the `SearchWidgetItem` instance.

### set ranking { .notintoc }

```typescript
set ranking(ranking: ArrayOfAtLeastOne<SearchRankingOptions>)
```

Sets the `ranking` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `ranking` | [`SearchRankingOptions[]`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/cloud-sdk-search-searchrankingoptions.md "SearchRankingOptions") | The ranking parameter of the search widget item. Used to configure search result ranking.<br><br>Minimum: `1`. |

#### Errors { .notintoc }

- [`IV-0016`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

### get personalization { .notintoc }

```typescript
get personalization(): SearchPersonalizationOptions | undefined
```

Returns the `personalization` property of the `SearchWidgetItem` instance.

### set personalization { .notintoc }

```typescript
set personalization(personalization: SearchPersonalizationOptions)
```

Sets the `personalization` property of the `SearchWidgetItem` instance.

#### Parameters { .notintoc }

| Name | Type | Description |
| --- | --- | --- |
| `personalization` | [`SearchPersonalizationOptions`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/types/cloud-sdk-search-searchpersonalizationoptions.html "SearchPersonalizationOptions") | Options for personalizing search results. |

#### Errors { .notintoc }

- [`IV-0030`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")
- [`IV-0031`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/classes/troubleshooting-the-cloud-sdk.html#UUID-e753bca7-34cd-82c3-cb33-6c1996ac600f_section-idm4566641646518433950839438956 "IV errors")

## Methods

### resetFacet

Resets the `facet` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetFacet(): void
```

#### Return value { .notintoc }

Returns void.

### resetQuery

Resets the `query` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetQuery(): void
```

#### Return value { .notintoc }

Returns void.

### resetOffset

Resets the `offset` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetOffset(): void
```

#### Return value { .notintoc }

Returns void.

### resetSort

Resets the `sort` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetSort(): void
```

#### Return value { .notintoc }

Returns void.

### resetSuggestion

Resets the `suggestion` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetSuggestion(): void
```

#### Return value { .notintoc }

Returns void.

### resetRanking

Resets the `ranking` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetRanking(): void
```

#### Return value { .notintoc }

Returns void.

### resetPersonalization

Resets the `personalization` property to `undefined`.

#### Signature { .notintoc }

```typescript
resetPersonalization(): void
```

#### Return value { .notintoc }

Returns void.

### toDTO

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

#### Signature { .notintoc }

```typescript
toDTO(): SearchWidgetItemDTO
```

#### Return value { .notintoc }

Returns the `SearchWidgetItem` instance in a standardized DTO format.

[^UUID-101b62f6-b640-ed11-1057-29646ebb9fb7_N67248fcfc8b58]: A *widget ID*, also known as the RFK ID, is a unique identifier assigned to every widget in Sitecore Search. Cloud SDK developers use the widget ID when requesting widget data and when capturing *events* that occur in a specific widget.

[^UUID-101b62f6-b640-ed11-1057-29646ebb9fb7_N6762bd56030ee]: A connector that retrieves items from a specified website, document, or repository, and indexes them so they are searchable. A source can be, for example, a web crawler, an API crawler, or an API push.
