Skip to content

Commit 631affc

Browse files
author
Anthony Oliveri
committed
feat(DiscoveryV1): Add retrievalDetails property to QueryResponse model
retrievalDetails uses a new type called RetrievalDetails
1 parent 13a90c1 commit 631affc

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

Source/DiscoveryV1/Models/QueryResponse.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public struct QueryResponse: Codable, Equatable {
3838
*/
3939
public var sessionToken: String?
4040

41+
/**
42+
An object contain retrieval type information.
43+
*/
44+
public var retrievalDetails: RetrievalDetails?
45+
4146
// Map each property name to the key that shall be used for encoding/decoding.
4247
private enum CodingKeys: String, CodingKey {
4348
case matchingResults = "matching_results"
@@ -46,6 +51,7 @@ public struct QueryResponse: Codable, Equatable {
4651
case passages = "passages"
4752
case duplicatesRemoved = "duplicates_removed"
4853
case sessionToken = "session_token"
54+
case retrievalDetails = "retrieval_details"
4955
}
5056

5157
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Copyright IBM Corporation 2018
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
**/
16+
17+
import Foundation
18+
19+
/**
20+
An object contain retrieval type information.
21+
*/
22+
public struct RetrievalDetails: Codable, Equatable {
23+
24+
/**
25+
Indentifies the document retrieval strategy used for this query. `relevancy_training` indicates that the results
26+
were returned using a relevancy trained model. `continuous_relevancy_training` indicates that the results were
27+
returned using the continuous relevancy training model created by result feedback analysis. `untrained` means the
28+
results were returned using the standard untrained model.
29+
**Note**: In the event of trained collections being queried, but the trained model is not used to return results,
30+
the **document_retrieval_strategy** will be listed as `untrained`.
31+
*/
32+
public enum DocumentRetrievalStrategy: String {
33+
case untrained = "untrained"
34+
case relevancyTraining = "relevancy_training"
35+
case continuousRelevancyTraining = "continuous_relevancy_training"
36+
}
37+
38+
/**
39+
Indentifies the document retrieval strategy used for this query. `relevancy_training` indicates that the results
40+
were returned using a relevancy trained model. `continuous_relevancy_training` indicates that the results were
41+
returned using the continuous relevancy training model created by result feedback analysis. `untrained` means the
42+
results were returned using the standard untrained model.
43+
**Note**: In the event of trained collections being queried, but the trained model is not used to return results,
44+
the **document_retrieval_strategy** will be listed as `untrained`.
45+
*/
46+
public var documentRetrievalStrategy: String?
47+
48+
// Map each property name to the key that shall be used for encoding/decoding.
49+
private enum CodingKeys: String, CodingKey {
50+
case documentRetrievalStrategy = "document_retrieval_strategy"
51+
}
52+
53+
}

WatsonDeveloperCloud.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@
10981098
924EE7E721505D810048C0E5 /* AssistantV2Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AssistantV2Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
10991099
92547738216D470F003C2829 /* QueryLarge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryLarge.swift; sourceTree = "<group>"; };
11001100
92547739216D4710003C2829 /* SearchStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchStatus.swift; sourceTree = "<group>"; };
1101+
926FAD6221BB3B2C00033989 /* RetrievalDetails.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RetrievalDetails.swift; sourceTree = "<group>"; };
11011102
928204BA2124BC1B0013315B /* CreateEventObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateEventObject.swift; sourceTree = "<group>"; };
11021103
928204BB2124BC1C0013315B /* MetricAggregationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetricAggregationResult.swift; sourceTree = "<group>"; };
11031104
928204BC2124BC1C0013315B /* MetricTokenAggregationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetricTokenAggregationResult.swift; sourceTree = "<group>"; };
@@ -1766,6 +1767,7 @@
17661767
68AF8ECE206968CC00D552E3 /* QueryResponse.swift */,
17671768
68AF8ECD206968CC00D552E3 /* QueryResult.swift */,
17681769
68AE2FD120697C2800330836 /* QueryResultMetadata.swift */,
1770+
926FAD6221BB3B2C00033989 /* RetrievalDetails.swift */,
17691771
92547739216D4710003C2829 /* SearchStatus.swift */,
17701772
682CBD2B209051B90049EE9F /* SegmentSettings.swift */,
17711773
CADA958F20FCD66500B5BD84 /* Source.swift */,

0 commit comments

Comments
 (0)