File tree Expand file tree Collapse file tree 3 files changed +66
-1
lines changed
main/java/com/ibm/watson/assistant/v2/model
test/java/com/ibm/watson/assistant/v2/model Expand file tree Collapse file tree 3 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 1414
1515import com .google .gson .annotations .SerializedName ;
1616import com .ibm .cloud .sdk .core .service .model .GenericModel ;
17+ import java .util .List ;
1718
1819/** SearchResult. */
1920public class SearchResult extends GenericModel {
@@ -27,6 +28,7 @@ public class SearchResult extends GenericModel {
2728 protected String title ;
2829 protected String url ;
2930 protected SearchResultHighlight highlight ;
31+ protected List <SearchResultAnswer > answers ;
3032
3133 /**
3234 * Gets the id.
@@ -99,4 +101,20 @@ public String getUrl() {
99101 public SearchResultHighlight getHighlight () {
100102 return highlight ;
101103 }
104+
105+ /**
106+ * Gets the answers.
107+ *
108+ * <p>An array specifying segments of text within the result that were identified as direct
109+ * answers to the search query. Currently, only the single answer with the highest confidence (if
110+ * any) is returned.
111+ *
112+ * <p>**Note:** This property uses the answer finding beta feature, and is available only if the
113+ * search skill is connected to a Discovery v2 service instance.
114+ *
115+ * @return the answers
116+ */
117+ public List <SearchResultAnswer > getAnswers () {
118+ return answers ;
119+ }
102120}
Original file line number Diff line number Diff line change 1+ /*
2+ * (C) Copyright IBM Corp. 2021.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+ * the License. You may obtain a copy of the License at
6+ *
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ *
9+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+ * specific language governing permissions and limitations under the License.
12+ */
13+ package com .ibm .watson .assistant .v2 .model ;
14+
15+ import com .ibm .cloud .sdk .core .service .model .GenericModel ;
16+
17+ /**
18+ * An object specifing a segment of text that was identified as a direct answer to the search query.
19+ */
20+ public class SearchResultAnswer extends GenericModel {
21+
22+ protected String text ;
23+ protected Double confidence ;
24+
25+ /**
26+ * Gets the text.
27+ *
28+ * <p>The text of the answer.
29+ *
30+ * @return the text
31+ */
32+ public String getText () {
33+ return text ;
34+ }
35+
36+ /**
37+ * Gets the confidence.
38+ *
39+ * <p>The confidence score for the answer, as returned by the Discovery service.
40+ *
41+ * @return the confidence
42+ */
43+ public Double getConfidence () {
44+ return confidence ;
45+ }
46+ }
Original file line number Diff line number Diff line change 11/*
2- * (C) Copyright IBM Corp. 2020 .
2+ * (C) Copyright IBM Corp. 2021 .
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55 * the License. You may obtain a copy of the License at
@@ -37,5 +37,6 @@ public void testSearchResult() throws Throwable {
3737 assertNull (searchResultModel .getTitle ());
3838 assertNull (searchResultModel .getUrl ());
3939 assertNull (searchResultModel .getHighlight ());
40+ assertNull (searchResultModel .getAnswers ());
4041 }
4142}
You can’t perform that action at this time.
0 commit comments