Skip to content

Commit 19a407a

Browse files
committed
feat(analytics): Add abTestID to the search response (#749)
1 parent 5f213fd commit 19a407a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Sources/AlgoliaSearchClient/Models/Search/Response/SearchResponse/SearchResponse+Codable.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ extension SearchResponse: Codable {
2929
case automaticRadius
3030
case serverUsed
3131
case indexUsed
32+
case abTestID
3233
case abTestVariantID
3334
case parsedQuery
3435
case facetsStorage = "facets"
@@ -67,6 +68,7 @@ extension SearchResponse: Codable {
6768
self.automaticRadius = legacyAutomaticRadius.flatMap(Double.init)
6869
self.serverUsed = try container.decodeIfPresent(forKey: .serverUsed)
6970
self.indexUsed = try container.decodeIfPresent(forKey: .indexUsed)
71+
self.abTestID = try container.decodeIfPresent(forKey: .abTestID)
7072
self.abTestVariantID = try container.decodeIfPresent(forKey: .abTestVariantID)
7173
self.parsedQuery = try container.decodeIfPresent(forKey: .parsedQuery)
7274
self.facetsStorage = try container.decodeIfPresent(forKey: .facetsStorage)
@@ -105,6 +107,7 @@ extension SearchResponse: Codable {
105107
try container.encodeIfPresent(legacyAutomaticRadius, forKey: .automaticRadius)
106108
try container.encodeIfPresent(serverUsed, forKey: .serverUsed)
107109
try container.encodeIfPresent(indexUsed, forKey: .indexUsed)
110+
try container.encodeIfPresent(abTestID, forKey: .abTestID)
108111
try container.encodeIfPresent(abTestVariantID, forKey: .abTestVariantID)
109112
try container.encodeIfPresent(parsedQuery, forKey: .parsedQuery)
110113
try container.encodeIfPresent(facetsStorage, forKey: .facetsStorage)

Sources/AlgoliaSearchClient/Models/Search/Response/SearchResponse/SearchResponse.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ public struct SearchResponse {
119119
- Returned only if Query.getRankingInfo is set to true.
120120
*/
121121
public var indexUsed: IndexName?
122+
123+
/**
124+
In case of A/B test, reports the ID of the A/B test used.
125+
- Returned only if [Query.getRankingInfo] is set to true.
126+
*/
127+
public var abTestID: ABTestID?
122128

123129
/**
124130
In case of A/B test, reports the variant ID used. The variant ID is the position in the array of variants

0 commit comments

Comments
 (0)