Skip to content

Commit c25ec23

Browse files
feat(rules): add applied rules to the search response (#812)
* feat: add applied rules to the search response
1 parent 150970e commit c25ec23

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-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
@@ -41,6 +41,7 @@ extension SearchResponse: Codable {
4141
case queryID
4242
case hierarchicalFacetsStorage = "hierarchicalFacets"
4343
case explain
44+
case appliedRules
4445
case renderingContent
4546
case appliedRelevancyStrictness
4647
case nbSortedHits
@@ -80,6 +81,7 @@ extension SearchResponse: Codable {
8081
self.queryID = try container.decodeIfPresent(forKey: .queryID)
8182
self.hierarchicalFacetsStorage = try container.decodeIfPresent(forKey: .hierarchicalFacetsStorage)
8283
self.explain = try container.decodeIfPresent(forKey: .explain)
84+
self.appliedRules = try container.decodeIfPresent(forKey: .appliedRules)
8385
self.renderingContent = try container.decodeIfPresent(forKey: .renderingContent)
8486
self.appliedRelevancyStrictness = try container.decodeIfPresent(forKey: .appliedRelevancyStrictness)
8587
self.nbSortedHits = try container.decodeIfPresent(forKey: .nbSortedHits)
@@ -119,6 +121,7 @@ extension SearchResponse: Codable {
119121
try container.encodeIfPresent(queryID, forKey: .queryID)
120122
try container.encodeIfPresent(hierarchicalFacetsStorage, forKey: .hierarchicalFacetsStorage)
121123
try container.encodeIfPresent(explain, forKey: .explain)
124+
try container.encodeIfPresent(appliedRules, forKey: .appliedRules)
122125
try container.encodeIfPresent(renderingContent, forKey: .renderingContent)
123126
try container.encodeIfPresent(appliedRelevancyStrictness, forKey: .appliedRelevancyStrictness)
124127
try container.encodeIfPresent(nbSortedHits, forKey: .nbSortedHits)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ public struct SearchResponse {
231231
*/
232232
public var explain: Explain?
233233

234+
/**
235+
The rules applied to the query.
236+
*/
237+
public var appliedRules: [JSON]?
238+
234239
/**
235240
The relevancy threshold applied to search in a virtual index.
236241
*/

0 commit comments

Comments
 (0)