SmartSnippet (Insight Engine)
SmartSnippet (Insight Engine)
This is for:
DeveloperMethods
beginDelayedSelectInlineLink
Prepares to select a link inside the answer after a certain delay, sending analytics if it was never selected before.
In a DOM context, we recommend calling this method on the touchstart
event.
Parameters
-
link:
InlineLink
The link to select.
cancelPendingSelectInlineLink
Cancels the pending selection caused by beginDelayedSelectInlineLink
.
In a DOM context, we recommend calling this method on the touchend
event.
Parameters
-
link:
InlineLink
The link to select.
selectInlineLink
Selects a link inside the answer, logging a UA event to the Coveo Platform if it was never selected before.
In a DOM context, we recommend calling this method on all of the following events: * contextmenu
* click
* mouseup
* mousedown
Parameters
-
link:
InlineLink
The link to select.
beginDelayedSelectSource
Prepares to select the source after a certain delay, sending analytics if it was never selected before.
In a DOM context, we recommend calling this method on the touchstart
event.
cancelPendingSelectSource
Cancels the pending selection caused by beginDelayedSelectSource
.
In a DOM context, we recommend calling this method on the touchend
event.
closeFeedbackModal
Allows the user to signal that they no longer wish to send feedback about why a particular answer was not relevant.
collapse
Collapse the snippet.
dislike
Allows the user to signal that a particular answer was not relevant.
expand
Expand the snippet.
like
Allows the user to signal that a particular answer was relevant.
openFeedbackModal
Allows the user to signal that they wish to send feedback about why a particular answer was not relevant.
selectSource
Selects the source, logging a UA event to the Coveo Platform if the source wasn’t already selected before.
In a DOM context, we recommend calling this method on all of the following events: * contextmenu
* click
* mouseup
* mousedown
sendDetailedFeedback
Allows the user to send detailed feedback about why a particular answer was not relevant.
Parameters
-
details:
string
A personalized message from the end user about the relevance of the answer.
sendFeedback
Allows the user to send feedback about why a particular answer was not relevant.
Parameters
-
feedback:
'does_not_answer' | 'partially_answers' | 'was_not_a_question'
The generic feedback that the end user wishes to send.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => void
A callback that’s invoked on state change.
Returns Unsubscribe
: A function to remove the listener.
Attributes
state
The state of the SmartSnippet controller.
Properties
-
answer:
string
The answer, or snippet, related to the question.
-
answerFound:
boolean
Determines of there is an available answer for the current query.
-
disliked:
boolean
Determines if the snippet was disliked, or downvoted by the end user.
-
documentId:
QuestionAnswerDocumentIdentifier
The index identifier for the document that provided the answer.
-
expanded:
boolean
Determines if the snippet is currently expanded.
-
feedbackModalOpen:
boolean
Determines if the feedback modal with the purpose of explaining why the end user disliked the snippet is currently opened.
-
liked:
boolean
Determines if the snippet was liked, or upvoted by the end user.
-
question:
string
The question related to the smart snippet.
-
source?:
Result
Provides the source of the smart snippet.
Initialize
buildSmartSnippet
Creates an insight SmartSnippet
controller instance.
Parameters
-
engine:
InsightEngine
The headless insight engine.
-
props:
SmartSnippetProps
The configurable
SmartSnippet
properties.
Returns SmartSnippet
SmartSnippetProps
The configurable SmartSnippet
properties.
Properties
-
options?:
SmartSnippetOptions
The options for the
SmartSnippet
controller.
SmartSnippetOptions
The options for the SmartSnippet
controller.
Properties
-
selectionDelay?:
number
The amount of time in milliseconds to wait before selecting the source or inline links after calling
beginDelayedSelectSource
orbeginDelayedSelectInlineLink
.Default:
1000
Related Types
HighlightKeyword
Properties
-
length:
number
The length of the offset.
-
offset:
number
The 0 based offset inside the string where the highlight should start.
InlineLink
Properties
-
linkText:
string
The text of the inline link.
-
linkURL:
string
The URL of the inline link.
QuestionAnswerDocumentIdentifier
Properties
-
contentIdKey:
string
The content identifier key. Typically,
permanentid
orurihash
. -
contentIdValue:
string
The content identifier value.
Raw
Properties
-
[key: string]:
unknown
Custom keys that depend on the documents in the index.
Result
Properties
-
absentTerms:
string[]
The basic query expression terms which this query result item does not match. Note: This property is populated by terms from the query pipeline-processed q value (not from the original q value).
-
clickUri:
string
The hyperlinkable item URI. Notes: Use the clickUri value when you want to create hyperlinks to the item, rather than the uri or printableUri value.
-
excerpt:
string
The contextual excerpt generated for the item (see the excerptLength query parameter).
-
excerptHighlights:
HighlightKeyword[]
The length and offset of each word to highlight in the item excerpt string.
-
firstSentences:
string
The first sentences retrieved from the item (see the retrieveFirstSentences query parameter).
-
firstSentencesHighlights:
HighlightKeyword[]
The length and offset of each word to highlight in the item firstSentences string.
-
flags:
string
The flags that are set on the item by the index. Distinct values are separated by semicolons.
-
hasHtmlVersion:
boolean
Whether the index contains an HTML version of this item.
-
isRecommendation:
boolean
Whether the item score was boosted as a Coveo ML recommendation.
-
isTopResult:
boolean
Whether the item score was boosted by a featured result rule in the query pipeline.
-
isUserActionView:
boolean
Whether the result item has been previously viewed by one of the users specified in the
canSeeUserProfileOf
section of the search token generated to perform the search request. -
percentScore:
number
The item ranking score expressed as a percentage (see the sortCriteria and rankingFunctions query parameters).
-
printableUri:
string
The human readable item URI. Note: Avoid using the printableUri value to create hyperlinks to the item. Use the clickUri value instead.
-
printableUriHighlights:
HighlightKeyword[]
The length and offset of each word to highlight in the item printableUri string.
-
rankingInfo:
string | null
The raw debug information generated by the index to detail how the item was ranked. This property is null unless the debug query parameter is set to true.
-
raw:
Raw
The values of the fields which were retrieved for this item (see the fieldsToInclude and fieldsToExclude query parameters).
-
score:
number
The total ranking score computed for the item (see the sortCriteria and rankingFunctions query parameters).
-
summary:
null
The item summary (see the summaryLength query parameter).
-
summaryHighlights:
HighlightKeyword[]
The length and offset of each word to highlight in the item summary string.
-
title:
string
Contains the title of the item.
-
titleHighlights:
HighlightKeyword[]
The length and offset of each word to highlight in the item title string.
-
uniqueId:
string
The unique item identifier. You should consider the uniqueId value as an opaque string.
-
uri:
string
The item URI. Notes: Avoid using the uri value to create hyperlinks to the item. Use the clickUri value instead.
-
rankingModifier?:
string
If applicable, represents the type of ranking modification that was applied to this result.
Unsubscribe
Call signatures
-
(): void;