Skip to content

Commit

Permalink
feat(DiscoveryV1): Add retrievalDetails property to QueryResponse model
Browse files Browse the repository at this point in the history
retrievalDetails uses a new type called RetrievalDetails
  • Loading branch information
Anthony Oliveri committed Dec 11, 2018
1 parent 13a90c1 commit 631affc
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/DiscoveryV1/Models/QueryResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public struct QueryResponse: Codable, Equatable {
*/
public var sessionToken: String?

/**
An object contain retrieval type information.
*/
public var retrievalDetails: RetrievalDetails?

// Map each property name to the key that shall be used for encoding/decoding.
private enum CodingKeys: String, CodingKey {
case matchingResults = "matching_results"
Expand All @@ -46,6 +51,7 @@ public struct QueryResponse: Codable, Equatable {
case passages = "passages"
case duplicatesRemoved = "duplicates_removed"
case sessionToken = "session_token"
case retrievalDetails = "retrieval_details"
}

}
53 changes: 53 additions & 0 deletions Source/DiscoveryV1/Models/RetrievalDetails.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

import Foundation

/**
An object contain retrieval type information.
*/
public struct RetrievalDetails: Codable, Equatable {

/**
Indentifies the document retrieval strategy used for this query. `relevancy_training` indicates that the results
were returned using a relevancy trained model. `continuous_relevancy_training` indicates that the results were
returned using the continuous relevancy training model created by result feedback analysis. `untrained` means the
results were returned using the standard untrained model.
**Note**: In the event of trained collections being queried, but the trained model is not used to return results,
the **document_retrieval_strategy** will be listed as `untrained`.
*/
public enum DocumentRetrievalStrategy: String {
case untrained = "untrained"
case relevancyTraining = "relevancy_training"
case continuousRelevancyTraining = "continuous_relevancy_training"
}

/**
Indentifies the document retrieval strategy used for this query. `relevancy_training` indicates that the results
were returned using a relevancy trained model. `continuous_relevancy_training` indicates that the results were
returned using the continuous relevancy training model created by result feedback analysis. `untrained` means the
results were returned using the standard untrained model.
**Note**: In the event of trained collections being queried, but the trained model is not used to return results,
the **document_retrieval_strategy** will be listed as `untrained`.
*/
public var documentRetrievalStrategy: String?

// Map each property name to the key that shall be used for encoding/decoding.
private enum CodingKeys: String, CodingKey {
case documentRetrievalStrategy = "document_retrieval_strategy"
}

}
2 changes: 2 additions & 0 deletions WatsonDeveloperCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@
924EE7E721505D810048C0E5 /* AssistantV2Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AssistantV2Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
92547738216D470F003C2829 /* QueryLarge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryLarge.swift; sourceTree = "<group>"; };
92547739216D4710003C2829 /* SearchStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchStatus.swift; sourceTree = "<group>"; };
926FAD6221BB3B2C00033989 /* RetrievalDetails.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RetrievalDetails.swift; sourceTree = "<group>"; };
928204BA2124BC1B0013315B /* CreateEventObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateEventObject.swift; sourceTree = "<group>"; };
928204BB2124BC1C0013315B /* MetricAggregationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetricAggregationResult.swift; sourceTree = "<group>"; };
928204BC2124BC1C0013315B /* MetricTokenAggregationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetricTokenAggregationResult.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1766,6 +1767,7 @@
68AF8ECE206968CC00D552E3 /* QueryResponse.swift */,
68AF8ECD206968CC00D552E3 /* QueryResult.swift */,
68AE2FD120697C2800330836 /* QueryResultMetadata.swift */,
926FAD6221BB3B2C00033989 /* RetrievalDetails.swift */,
92547739216D4710003C2829 /* SearchStatus.swift */,
682CBD2B209051B90049EE9F /* SegmentSettings.swift */,
CADA958F20FCD66500B5BD84 /* Source.swift */,
Expand Down

0 comments on commit 631affc

Please sign in to comment.