@Override public SearchQueryResult query(SearchQuery query) { return query(query, environment.searchTimeout(), TIMEOUT_UNIT); }
@Override public Observable<AsyncSearchQueryResult> query(SearchQuery query) { return query(query, environment.searchTimeout(), TimeUnit.MILLISECONDS); }
/** * Synchronously perform a {@link SearchQuery} and return the raw N1QL response as a String. * * Note that the query is executed "as is", without any processing comparable to what is done in * {@link Bucket#query(SearchQuery)} (like enforcing a server side timeout). * * @param query the query to execute. * @return the FTS response as a String. */ public String ftsToRawJson(SearchQuery query) { return Blocking.blockForSingle(async.ftsToRawJson(query), env.searchTimeout(), TimeUnit.MILLISECONDS); }
/** * Synchronously perform a {@link SearchQuery} and return the raw N1QL response as a {@link JsonObject}. * * Note that the query is executed "as is", without any processing comparable to what is done in * {@link Bucket#query(SearchQuery)} (like enforcing a server side timeout). * * @param query the query to execute. * @return the FTS response as a {@link JsonObject}. */ public JsonObject ftsToJsonObject(SearchQuery query) { return Blocking.blockForSingle(async.ftsToJsonObject(query), env.searchTimeout(), TimeUnit.MILLISECONDS); }
/** * Synchronously perform a {@link SearchQuery} and apply a user function to deserialize the raw JSON * FTS response, which is represented as a {@link String}. * * Note that the query is executed "as is", without any processing comparable to what is done in * {@link Bucket#query(SearchQuery)} (like enforcing a server side timeout). * * @param query the query to execute. * @param deserializer a deserializer function that transforms the String representation of the response into a custom type T. * @param <T> the type of the response, once deserialized by the user-provided function. * @return the FTS response as a T. */ public <T> T ftsToRawCustom(final SearchQuery query, final Func1<String, T> deserializer) { return Blocking.blockForSingle(async.ftsToRawCustom(query, deserializer), env.searchTimeout(), TimeUnit.MILLISECONDS); } }
@Override public Observable<AsyncSearchQueryResult> query(final SearchQuery query, final long timeout, final TimeUnit timeUnit) { //always set a server side timeout. if not explicit, set it to the client side timeout if (query.getServerSideTimeout() == null) { query.serverSideTimeout(environment().searchTimeout(), TimeUnit.MILLISECONDS); } return searchQueryExecutor.execute(query, timeout, timeUnit); }