Feedback

VERSION 0.2.3323
experimental

The Feedback API collects user interactions with the search functionality in apps. This feedback is used to further improve search results.

The API is lightweight and takes very little code to use. Providing the feedback will improve search results for all end-users of the search service. The Feedback API is used throughout a search session. A search session starts with a user typing keyword and looking for a specific result. Users may "select" a result to see its details or "accept" a result as a conclusion.

Search sessions are identified by a Session ID.

To use the Feedback API, start by generating a UUIDv4 session ID. It will be used in Search request and Feedback request. Pass it to search or autocomplete options during a search session.

1let resultID = FeedbackResultIDFactory.createApplicationSpecificFeedbackResultID(id: "Your app ID")
2let sessionID = UUID()
3let options = SearchOptions(
4 query: "TomTom",
5 geoBias: CLLocationCoordinate2D(latitude: 52.377956, longitude: 4.897070),
6 limit: 5,
7 sessionID: sessionID
8)
9onlineSearch.search(options: options) { result in
10 switch result {
11 case let .success(fuzzySearchResponse):
12 // handle success
13 break
14 case let .failure(error):
15 // handle error
16 break
17 }
18}

When users interact with the search results, create a FeedbackEvent with the session ID and relevant fields such as type. Call sendFeedback to send the event.

1let selectEvent = FeedbackEvent(
2 sessionID: sessionID,
3 type: .select,
4 resultID: resultID,
5 position: 0,
6 actionTime: Date()
7)
8onlineSearch.sendFeedback(feedbackEvent: selectEvent) { error in
9 print(error)
10}