Search in sources :

Example 1 with QueryNoticesOptions

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

the class Discovery method queryNotices.

/**
 * Query 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 queryNoticesOptions the {@link QueryNoticesOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link QueryNoticesResponse}
 */
public ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryNoticesOptions) {
    Validator.notNull(queryNoticesOptions, "queryNoticesOptions cannot be null");
    String[] pathSegments = { "v1/environments", "collections", "notices" };
    String[] pathParameters = { queryNoticesOptions.environmentId(), queryNoticesOptions.collectionId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    builder.query(VERSION, versionDate);
    if (queryNoticesOptions.filter() != null) {
        builder.query("filter", queryNoticesOptions.filter());
    }
    if (queryNoticesOptions.query() != null) {
        builder.query("query", queryNoticesOptions.query());
    }
    if (queryNoticesOptions.naturalLanguageQuery() != null) {
        builder.query("natural_language_query", queryNoticesOptions.naturalLanguageQuery());
    }
    if (queryNoticesOptions.passages() != null) {
        builder.query("passages", String.valueOf(queryNoticesOptions.passages()));
    }
    if (queryNoticesOptions.aggregation() != null) {
        builder.query("aggregation", queryNoticesOptions.aggregation());
    }
    if (queryNoticesOptions.count() != null) {
        builder.query("count", String.valueOf(queryNoticesOptions.count()));
    }
    if (queryNoticesOptions.returnFields() != null) {
        builder.query("return_fields", RequestUtils.join(queryNoticesOptions.returnFields(), ","));
    }
    if (queryNoticesOptions.offset() != null) {
        builder.query("offset", String.valueOf(queryNoticesOptions.offset()));
    }
    if (queryNoticesOptions.sort() != null) {
        builder.query("sort", RequestUtils.join(queryNoticesOptions.sort(), ","));
    }
    if (queryNoticesOptions.highlight() != null) {
        builder.query("highlight", String.valueOf(queryNoticesOptions.highlight()));
    }
    if (queryNoticesOptions.passagesFields() != null) {
        builder.query("passages.fields", RequestUtils.join(queryNoticesOptions.passagesFields(), ","));
    }
    if (queryNoticesOptions.passagesCount() != null) {
        builder.query("passages.count", String.valueOf(queryNoticesOptions.passagesCount()));
    }
    if (queryNoticesOptions.passagesCharacters() != null) {
        builder.query("passages.characters", String.valueOf(queryNoticesOptions.passagesCharacters()));
    }
    if (queryNoticesOptions.deduplicateField() != null) {
        builder.query("deduplicate.field", queryNoticesOptions.deduplicateField());
    }
    if (queryNoticesOptions.similar() != null) {
        builder.query("similar", String.valueOf(queryNoticesOptions.similar()));
    }
    if (queryNoticesOptions.similarDocumentIds() != null) {
        builder.query("similar.document_ids", RequestUtils.join(queryNoticesOptions.similarDocumentIds(), ","));
    }
    if (queryNoticesOptions.similarFields() != null) {
        builder.query("similar.fields", RequestUtils.join(queryNoticesOptions.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