1. @sitecore-cloudsdk/search/server

QuestionsAnswersWidgetItem

Version:

Type

Class

Extends

RuleWidgetItem

Import path

@sitecore-cloudsdk/search/server

A widget item for a questions-answers widget.

Constructor

QuestionsAnswersWidgetItem(
  entity: string,
  widgetId: string,
  questionsAnswersOptions: QuestionsAnswersOptions,
  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.

For questions and answers widgets, use the following ID: "rfkid_qa".

questionsAnswersOptions

QuestionsAnswersOptions

Options for retrieving AI-powered questions and answers.

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

_keyphrase

string

The text the site visitor enters in the search field to perform a search.

Minimum length: 1.

Maximum length: 100.

_exactAnswer

ExactAnswerOptions

Optional.

Options to retrieve a single answer to the site visitor's query. Used in the questions-answers object of a widget item.

_relatedQuestions

RelatedQuestionsOptions

Optional.

Options to retrieve AI-generated question-and-answer pairs relevant to the site visitor's query. Used in the questions-answers object of a widget item.

Accessors

The following properties are available to get and set:

get keyphrase

get keyphrase(): string

Returns the keyphrase property of the QuestionsAnswersWidgetItem instance.

set keyphrase

set keyphrase(keyphrase: string)

Sets the keyphrase property of the QuestionsAnswersWidgetItem instance.

Parameters

Name

Type

Description

keyphrase

string

The text the site visitor enters in the search field to perform a search.

Minimum length: 1.

Maximum length: 100.

Errors

get exactAnswer

get exactAnswer(): ExactAnswerOptions | undefined 

Returns the exactAnswer property of the QuestionsAnswersWidgetItem instance.

set exactAnswer

set exactAnswer(exactAnswer: ExactAnswerOptions)

Sets the exactAnswer property of the QuestionsAnswersWidgetItem instance.

Parameters

Name

Type

Description

exactAnswer

ExactAnswerOptions

Options to retrieve a single answer to the site visitor's query. Used in the questions-answers object of a widget item.

get relatedQuestions

get relatedQuestions(): RelatedQuestionsOptions | undefined 

Returns the relatedQuestions property of the QuestionsAnswersWidgetItem instance.

set relatedQuestions

set relatedQuestions(relatedQuestions: RelatedQuestionsOptions)

Sets the relatedQuestions property of the QuestionsAnswersWidgetItem instance.

Parameters

Name

Type

Description

relatedQuestions

RelatedQuestionsOptions

Options to retrieve AI-generated question-and-answer pairs relevant to the site visitor's query. Used in the questions-answers object of a widget item.

Methods

_validateRelatedQuestions

Validates the provided relatedQuestions.

Signature

private _validateRelatedQuestions(relatedQuestions: RelatedQuestionsOptions): void

Parameters

Name

Type

Description

relatedQuestions

RelatedQuestionsOptions

Options to retrieve AI-generated question-and-answer pairs relevant to the site visitor's query. Used in the questions-answers object of a widget item.

Return value

Returns void.

Errors

resetExactAnswer

Resets exactAnswer to undefined.

Signature

exactAnswer(): void

Return value

Returns void.

resetRelatedQuestions

Resets relatedQuestions to undefined.

Signature

resetRelatedQuestions(): void

Return value

Returns void.

toDTO

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

Signature

toDTO(): QuestionsAnswersWidgetItemDTO

Return value

Returns the QuestionsAnswersWidgetItem instance in a standardized DTO format.

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