Search in sources :

Example 16 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class AsyncCluster method searchQuery.

/**
 * Performs a Full Text Search (FTS) query with custom {@link SearchOptions}.
 *
 * @param query the query, in the form of a {@link SearchQuery}
 * @param options the custom options for this query.
 * @return the {@link SearchRequest} once the response arrives successfully, inside a {@link CompletableFuture}
 */
public CompletableFuture<SearchResult> searchQuery(final String indexName, final SearchQuery query, final SearchOptions options) {
    notNull(query, "SearchQuery", () -> new ReducedSearchErrorContext(indexName, null));
    notNull(options, "SearchOptions", () -> new ReducedSearchErrorContext(indexName, query.export().toMap()));
    SearchOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment.get().jsonSerializer() : opts.serializer();
    return SearchAccessor.searchQueryAsync(core, searchRequest(indexName, query, opts), serializer);
}
Also used : ReducedSearchErrorContext(com.couchbase.client.core.error.context.ReducedSearchErrorContext) SearchOptions(com.couchbase.client.java.search.SearchOptions) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer)

Example 17 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class AsyncCluster method analyticsQuery.

/**
 * Performs an Analytics query with custom {@link AnalyticsOptions}.
 *
 * @param statement the Analytics query statement as a raw string.
 * @param options the custom options for this analytics query.
 * @return the {@link AnalyticsResult} once the response arrives successfully.
 */
public CompletableFuture<AnalyticsResult> analyticsQuery(final String statement, final AnalyticsOptions options) {
    notNull(options, "AnalyticsOptions", () -> new ReducedAnalyticsErrorContext(statement));
    AnalyticsOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment.get().jsonSerializer() : opts.serializer();
    return AnalyticsAccessor.analyticsQueryAsync(core, analyticsRequest(statement, opts), serializer);
}
Also used : ReducedAnalyticsErrorContext(com.couchbase.client.core.error.context.ReducedAnalyticsErrorContext) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer) AnalyticsOptions(com.couchbase.client.java.analytics.AnalyticsOptions)

Example 18 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class AsyncCluster method query.

/**
 * Performs a N1QL query with custom {@link QueryOptions}.
 *
 * @param statement the N1QL query statement as a raw string.
 * @param options the custom options for this query.
 * @return the {@link QueryResult} once the response arrives successfully.
 */
public CompletableFuture<QueryResult> query(final String statement, final QueryOptions options) {
    notNull(options, "QueryOptions", () -> new ReducedQueryErrorContext(statement));
    final QueryOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment.get().jsonSerializer() : opts.serializer();
    return queryAccessor.queryAsync(queryRequest(statement, opts), opts, serializer);
}
Also used : JsonSerializer(com.couchbase.client.java.codec.JsonSerializer) ReducedQueryErrorContext(com.couchbase.client.core.error.context.ReducedQueryErrorContext) QueryOptions(com.couchbase.client.java.query.QueryOptions)

Aggregations

JsonSerializer (com.couchbase.client.java.codec.JsonSerializer)18 ReducedAnalyticsErrorContext (com.couchbase.client.core.error.context.ReducedAnalyticsErrorContext)4 ReducedQueryErrorContext (com.couchbase.client.core.error.context.ReducedQueryErrorContext)4 AnalyticsOptions (com.couchbase.client.java.analytics.AnalyticsOptions)4 ClusterEnvironment (com.couchbase.client.java.env.ClusterEnvironment)4 QueryOptions (com.couchbase.client.java.query.QueryOptions)4 LookupInOptions (com.couchbase.client.java.kv.LookupInOptions)3 ReducedSearchErrorContext (com.couchbase.client.core.error.context.ReducedSearchErrorContext)2 ReducedViewErrorContext (com.couchbase.client.core.error.context.ReducedViewErrorContext)2 SubdocGetRequest (com.couchbase.client.core.msg.kv.SubdocGetRequest)2 RetryStrategy (com.couchbase.client.core.retry.RetryStrategy)2 JacksonJsonSerializer (com.couchbase.client.java.codec.JacksonJsonSerializer)2 SearchOptions (com.couchbase.client.java.search.SearchOptions)2 Duration (java.time.Duration)2 Test (org.junit.jupiter.api.Test)2 Core (com.couchbase.client.core.Core)1 CoreContext (com.couchbase.client.core.CoreContext)1 Stability (com.couchbase.client.core.annotation.Stability)1 RequestSpan (com.couchbase.client.core.cnc.RequestSpan)1 TracingIdentifiers (com.couchbase.client.core.cnc.TracingIdentifiers)1