Skip to content

Commit 776048c

Browse files
committed
feat(discovery-v1): document status & query aggregation update
DocumentStatus: documentID, status, and statusDescription are now optional. QueryAggregation: BREAKING QueryAggregation subclasses changed. BREAKING CHANGE: QueryAggregation: BREAKING QueryAggregation subclasses changed.
1 parent 96d610f commit 776048c

22 files changed

+569
-515
lines changed

discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2017, 2020.
2+
* (C) Copyright IBM Corp. 2022.
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
@@ -237,16 +237,11 @@ public Boolean overwrite() {
237237
/**
238238
* Gets the enrichment.
239239
*
240-
* <p>Name of the enrichment service to call. Current options are `natural_language_understanding`
241-
* and `elements`.
240+
* <p>Name of the enrichment service to call. The only supported option is
241+
* `natural_language_understanding`. The `elements` option is deprecated and support ended on 10
242+
* July 2020.
242243
*
243-
* <p>When using `natual_language_understanding`, the **options** object must contain Natural
244-
* Language Understanding options.
245-
*
246-
* <p>When using `elements` the **options** object must contain Element Classification options.
247-
* Additionally, when using the `elements` enrichment the configuration specified and files
248-
* ingested must meet all the criteria specified in [the
249-
* documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-element-classification#element-classification).
244+
* <p>The **options** object must contain Natural Language Understanding options.
250245
*
251246
* @return the enrichment
252247
*/
@@ -269,7 +264,11 @@ public Boolean ignoreDownstreamErrors() {
269264
/**
270265
* Gets the options.
271266
*
272-
* <p>Options which are specific to a particular enrichment.
267+
* <p>Options that are specific to a particular enrichment.
268+
*
269+
* <p>The `elements` enrichment type is deprecated. Use the [Create a
270+
* project](https://cloud.ibm.com/apidocs/discovery-data#createproject) method of the Discovery v2
271+
* API to create a `content_intelligence` project type instead.
273272
*
274273
* @return the options
275274
*/

discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2017, 2021.
2+
* (C) Copyright IBM Corp. 2022.
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
@@ -14,7 +14,13 @@
1414

1515
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1616

17-
/** Options which are specific to a particular enrichment. */
17+
/**
18+
* Options that are specific to a particular enrichment.
19+
*
20+
* <p>The `elements` enrichment type is deprecated. Use the [Create a
21+
* project](https://cloud.ibm.com/apidocs/discovery-data#createproject) method of the Discovery v2
22+
* API to create a `content_intelligence` project type instead.
23+
*/
1824
public class EnrichmentOptions extends GenericModel {
1925

2026
/**
@@ -151,8 +157,8 @@ public String language() {
151157
/**
152158
* Gets the model.
153159
*
154-
* <p>For use with `elements` enrichments only. The element extraction model to use. The only
155-
* model available is `contract`.
160+
* <p>The element extraction model to use, which can be `contract` only. The `elements` enrichment
161+
* is deprecated.
156162
*
157163
* @return the model
158164
*/

discovery/src/main/java/com/ibm/watson/discovery/v1/model/Filter.java

-30
This file was deleted.

discovery/src/main/java/com/ibm/watson/discovery/v1/model/Nested.java

-30
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2020.
2+
* (C) Copyright IBM Corp. 2022.
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
@@ -12,9 +12,7 @@
1212
*/
1313
package com.ibm.watson.discovery.v1.model;
1414

15-
import com.google.gson.annotations.SerializedName;
1615
import com.ibm.cloud.sdk.core.service.model.GenericModel;
17-
import java.util.List;
1816

1917
/** An aggregation produced by Discovery to analyze the input provided. */
2018
public class QueryAggregation extends GenericModel {
@@ -25,26 +23,20 @@ public class QueryAggregation extends GenericModel {
2523

2624
static {
2725
discriminatorMapping = new java.util.HashMap<>();
28-
discriminatorMapping.put("histogram", Histogram.class);
29-
discriminatorMapping.put("max", Calculation.class);
30-
discriminatorMapping.put("min", Calculation.class);
31-
discriminatorMapping.put("average", Calculation.class);
32-
discriminatorMapping.put("sum", Calculation.class);
33-
discriminatorMapping.put("unique_count", Calculation.class);
34-
discriminatorMapping.put("term", Term.class);
35-
discriminatorMapping.put("filter", Filter.class);
36-
discriminatorMapping.put("nested", Nested.class);
37-
discriminatorMapping.put("timeslice", Timeslice.class);
38-
discriminatorMapping.put("top_hits", TopHits.class);
26+
discriminatorMapping.put("histogram", QueryHistogramAggregation.class);
27+
discriminatorMapping.put("max", QueryCalculationAggregation.class);
28+
discriminatorMapping.put("min", QueryCalculationAggregation.class);
29+
discriminatorMapping.put("average", QueryCalculationAggregation.class);
30+
discriminatorMapping.put("sum", QueryCalculationAggregation.class);
31+
discriminatorMapping.put("unique_count", QueryCalculationAggregation.class);
32+
discriminatorMapping.put("term", QueryTermAggregation.class);
33+
discriminatorMapping.put("filter", QueryFilterAggregation.class);
34+
discriminatorMapping.put("nested", QueryNestedAggregation.class);
35+
discriminatorMapping.put("timeslice", QueryTimesliceAggregation.class);
36+
discriminatorMapping.put("top_hits", QueryTopHitsAggregation.class);
3937
}
4038

4139
protected String type;
42-
protected List<AggregationResult> results;
43-
44-
@SerializedName("matching_results")
45-
protected Long matchingResults;
46-
47-
protected List<QueryAggregation> aggregations;
4840

4941
/**
5042
* Gets the type.
@@ -56,37 +48,4 @@ public class QueryAggregation extends GenericModel {
5648
public String getType() {
5749
return type;
5850
}
59-
60-
/**
61-
* Gets the results.
62-
*
63-
* <p>Array of aggregation results.
64-
*
65-
* @return the results
66-
*/
67-
public List<AggregationResult> getResults() {
68-
return results;
69-
}
70-
71-
/**
72-
* Gets the matchingResults.
73-
*
74-
* <p>Number of matching results.
75-
*
76-
* @return the matchingResults
77-
*/
78-
public Long getMatchingResults() {
79-
return matchingResults;
80-
}
81-
82-
/**
83-
* Gets the aggregations.
84-
*
85-
* <p>Aggregations returned by Discovery.
86-
*
87-
* @return the aggregations
88-
*/
89-
public List<QueryAggregation> getAggregations() {
90-
return aggregations;
91-
}
9251
}

discovery/src/main/java/com/ibm/watson/discovery/v1/model/Calculation.java renamed to discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregation.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2020.
2+
* (C) Copyright IBM Corp. 2022.
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
@@ -12,16 +12,19 @@
1212
*/
1313
package com.ibm.watson.discovery.v1.model;
1414

15-
/** Calculation. */
16-
public class Calculation extends QueryAggregation {
15+
/**
16+
* Returns a scalar calculation across all documents for the field specified. Possible calculations
17+
* include min, max, sum, average, and unique_count.
18+
*/
19+
public class QueryCalculationAggregation extends QueryAggregation {
1720

1821
protected String field;
1922
protected Double value;
2023

2124
/**
2225
* Gets the field.
2326
*
24-
* <p>The field where the aggregation is located in the document.
27+
* <p>The field to perform the calculation on.
2528
*
2629
* @return the field
2730
*/
@@ -32,7 +35,7 @@ public String getField() {
3235
/**
3336
* Gets the value.
3437
*
35-
* <p>Value of the aggregation.
38+
* <p>The value of the calculation.
3639
*
3740
* @return the value
3841
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
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.discovery.v1.model;
14+
15+
import com.google.gson.annotations.SerializedName;
16+
import java.util.List;
17+
18+
/** A modifier that narrows the document set of the sub-aggregations it precedes. */
19+
public class QueryFilterAggregation extends QueryAggregation {
20+
21+
protected String match;
22+
23+
@SerializedName("matching_results")
24+
protected Long matchingResults;
25+
26+
protected List<QueryAggregation> aggregations;
27+
28+
/**
29+
* Gets the match.
30+
*
31+
* <p>The filter that is written in Discovery Query Language syntax and is applied to the
32+
* documents before sub-aggregations are run.
33+
*
34+
* @return the match
35+
*/
36+
public String getMatch() {
37+
return match;
38+
}
39+
40+
/**
41+
* Gets the matchingResults.
42+
*
43+
* <p>Number of documents that match the filter.
44+
*
45+
* @return the matchingResults
46+
*/
47+
public Long getMatchingResults() {
48+
return matchingResults;
49+
}
50+
51+
/**
52+
* Gets the aggregations.
53+
*
54+
* <p>An array of sub-aggregations.
55+
*
56+
* @return the aggregations
57+
*/
58+
public List<QueryAggregation> getAggregations() {
59+
return aggregations;
60+
}
61+
}

discovery/src/main/java/com/ibm/watson/discovery/v1/model/Histogram.java renamed to discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregation.java

+34-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2020.
2+
* (C) Copyright IBM Corp. 2022.
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
@@ -12,16 +12,23 @@
1212
*/
1313
package com.ibm.watson.discovery.v1.model;
1414

15-
/** Histogram. */
16-
public class Histogram extends QueryAggregation {
15+
import java.util.List;
16+
17+
/**
18+
* Numeric interval segments to categorize documents by using field values from a single numeric
19+
* field to describe the category.
20+
*/
21+
public class QueryHistogramAggregation extends QueryAggregation {
1722

1823
protected String field;
1924
protected Long interval;
25+
protected String name;
26+
protected List<QueryHistogramAggregationResult> results;
2027

2128
/**
2229
* Gets the field.
2330
*
24-
* <p>The field where the aggregation is located in the document.
31+
* <p>The numeric field name used to create the histogram.
2532
*
2633
* @return the field
2734
*/
@@ -32,11 +39,33 @@ public String getField() {
3239
/**
3340
* Gets the interval.
3441
*
35-
* <p>Interval of the aggregation. (For 'histogram' type).
42+
* <p>The size of the sections that the results are split into.
3643
*
3744
* @return the interval
3845
*/
3946
public Long getInterval() {
4047
return interval;
4148
}
49+
50+
/**
51+
* Gets the name.
52+
*
53+
* <p>Identifier specified in the query request of this aggregation.
54+
*
55+
* @return the name
56+
*/
57+
public String getName() {
58+
return name;
59+
}
60+
61+
/**
62+
* Gets the results.
63+
*
64+
* <p>Array of numeric intervals.
65+
*
66+
* @return the results
67+
*/
68+
public List<QueryHistogramAggregationResult> getResults() {
69+
return results;
70+
}
4271
}

0 commit comments

Comments
 (0)