Search in sources :

Example 1 with FederatedQueryNoticesOptions

use of com.ibm.watson.developer_cloud.discovery.v1.model.FederatedQueryNoticesOptions in project java-sdk by watson-developer-cloud.

the class Discovery method federatedQueryNotices.

/**
 * Query multiple collection system notices.
 *
 * Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when
 * ingesting documents and performing relevance training. See the [Discovery service
 * documentation](https://console.bluemix.net/docs/services/discovery/using.html) for more details on the query
 * language.
 *
 * @param federatedQueryNoticesOptions the {@link FederatedQueryNoticesOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link QueryNoticesResponse}
 */
public ServiceCall<QueryNoticesResponse> federatedQueryNotices(FederatedQueryNoticesOptions federatedQueryNoticesOptions) {
    Validator.notNull(federatedQueryNoticesOptions, "federatedQueryNoticesOptions cannot be null");
    String[] pathSegments = { "v1/environments", "notices" };
    String[] pathParameters = { federatedQueryNoticesOptions.environmentId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    builder.query(VERSION, versionDate);
    builder.query("collection_ids", RequestUtils.join(federatedQueryNoticesOptions.collectionIds(), ","));
    if (federatedQueryNoticesOptions.filter() != null) {
        builder.query("filter", federatedQueryNoticesOptions.filter());
    }
    if (federatedQueryNoticesOptions.query() != null) {
        builder.query("query", federatedQueryNoticesOptions.query());
    }
    if (federatedQueryNoticesOptions.naturalLanguageQuery() != null) {
        builder.query("natural_language_query", federatedQueryNoticesOptions.naturalLanguageQuery());
    }
    if (federatedQueryNoticesOptions.aggregation() != null) {
        builder.query("aggregation", federatedQueryNoticesOptions.aggregation());
    }
    if (federatedQueryNoticesOptions.count() != null) {
        builder.query("count", String.valueOf(federatedQueryNoticesOptions.count()));
    }
    if (federatedQueryNoticesOptions.returnFields() != null) {
        builder.query("return_fields", RequestUtils.join(federatedQueryNoticesOptions.returnFields(), ","));
    }
    if (federatedQueryNoticesOptions.offset() != null) {
        builder.query("offset", String.valueOf(federatedQueryNoticesOptions.offset()));
    }
    if (federatedQueryNoticesOptions.sort() != null) {
        builder.query("sort", RequestUtils.join(federatedQueryNoticesOptions.sort(), ","));
    }
    if (federatedQueryNoticesOptions.highlight() != null) {
        builder.query("highlight", String.valueOf(federatedQueryNoticesOptions.highlight()));
    }
    if (federatedQueryNoticesOptions.deduplicateField() != null) {
        builder.query("deduplicate.field", federatedQueryNoticesOptions.deduplicateField());
    }
    if (federatedQueryNoticesOptions.similar() != null) {
        builder.query("similar", String.valueOf(federatedQueryNoticesOptions.similar()));
    }
    if (federatedQueryNoticesOptions.similarDocumentIds() != null) {
        builder.query("similar.document_ids", RequestUtils.join(federatedQueryNoticesOptions.similarDocumentIds(), ","));
    }
    if (federatedQueryNoticesOptions.similarFields() != null) {
        builder.query("similar.fields", RequestUtils.join(federatedQueryNoticesOptions.similarFields(), ","));
    }
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryNoticesResponse.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) QueryNoticesResponse(com.ibm.watson.developer_cloud.discovery.v1.model.QueryNoticesResponse)

Aggregations

QueryNoticesResponse (com.ibm.watson.developer_cloud.discovery.v1.model.QueryNoticesResponse)1 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)1