use of com.couchbase.client.core.error.context.ReducedSearchErrorContext in project couchbase-jvm-clients by couchbase.
the class ReactiveCluster 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 Mono}
*/
public Mono<ReactiveSearchResult> 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().jsonSerializer() : opts.serializer();
return Mono.defer(() -> {
return SearchAccessor.searchQueryReactive(asyncCluster.core(), asyncCluster.searchRequest(indexName, query, opts), serializer);
});
}
use of com.couchbase.client.core.error.context.ReducedSearchErrorContext 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);
}
use of com.couchbase.client.core.error.context.ReducedSearchErrorContext in project couchbase-jvm-clients by couchbase.
the class AsyncCluster method searchRequest.
SearchRequest searchRequest(final String indexName, final SearchQuery query, final SearchOptions.Built opts) {
notNullOrEmpty(indexName, "IndexName", () -> new ReducedSearchErrorContext(indexName, query.export().toMap()));
Duration timeout = opts.timeout().orElse(environment.get().timeoutConfig().searchTimeout());
JsonObject params = query.export();
opts.injectParams(indexName, params, timeout);
byte[] bytes = params.toString().getBytes(StandardCharsets.UTF_8);
RetryStrategy retryStrategy = opts.retryStrategy().orElse(environment.get().retryStrategy());
final RequestSpan span = environment().requestTracer().requestSpan(TracingIdentifiers.SPAN_REQUEST_SEARCH, opts.parentSpan().orElse(null));
SearchRequest request = new SearchRequest(timeout, core.context(), retryStrategy, authenticator, indexName, bytes, span);
request.context().clientContext(opts.clientContext());
return request;
}
Aggregations