sendFeedback

open override fun sendFeedback(feedbackEvent: FeedbackEvent): Result<Unit, SearchFailure>

Synchronously sends a feedback event for the search.

Return

The Result containing a Unit if the call succeeds, or a SearchFailure if it fails.

Example of a feedback request:

val dateTime = Date()
val feedbackEvent = FeedbackEvent(
sessionId = UUID.randomUUID(),
type = FeedbackEventType.Select,
resultId = ServiceFeedbackResultId(selectedSearchResultId),
position = selectedSearchResultIndex,
actionTime = dateTime
)
val response = search.sendFeedback(feedbackEvent)
if (response.isSuccess()) {
Log.d("tag", "Feedback sent")
} else {
val failure: SearchFailure = response.failure()
Log.e("tag", failure.message)
}

Parameters

feedbackEvent

The feedback event.


open override fun sendFeedback(feedbackEvent: FeedbackEvent, callback: FeedbackCallback): Cancellable

Asynchronously sends a feedback event for the search.

Parameters

feedbackEvent

The feedback event.

callback

The FeedbackCallback invoked when the feedback operation has finished. It returns an error if the operation fails.

Example of a feedback request:

val dateTime = Date()
val feedbackEvent = FeedbackEvent(
sessionId = UUID.randomUUID(),
type = FeedbackEventType.Select,
resultId = ServiceFeedbackResultId(selectedSearchResultId),
position = selectedSearchResultIndex,
actionTime = dateTime
)
search.sendFeedback(feedbackEvent, object : FeedbackCallback {
override fun onSuccess(result: Unit) {
Log.d("tag", "Feedback sent")
}

override fun onFailure(failure: SearchFailure) {
Log.e("tag", failure.message)
}
})