Class DefaultAsyncSearchQueryResult
- java.lang.Object
-
- com.couchbase.client.java.search.result.impl.DefaultAsyncSearchQueryResult
-
- All Implemented Interfaces:
AsyncSearchQueryResult
@Committed @Public public class DefaultAsyncSearchQueryResult extends Object implements AsyncSearchQueryResult
The default implementation for anAsyncSearchQueryResult- Since:
- 2.3.0
- Author:
- Simon Baslé, Michael Nitschinger
-
-
Constructor Summary
Constructors Constructor Description DefaultAsyncSearchQueryResult(SearchStatus status, rx.Observable<SearchQueryRow> hits, rx.Observable<FacetResult> facets, rx.Observable<SearchMetrics> metrics)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description rx.Observable<FacetResult>facets()AnObservableemitting aFacetResultfor each requested facet in the original request.static AsyncSearchQueryResultfromHttp400(String payload)Deprecated.FTS is still in BETA so the response format is likely to change in a future version, and be unified with the HTTP 200 response format.static AsyncSearchQueryResultfromHttp412()Deprecated.FTS is still in BETA so the response format is likely to change in a future version, and be unified with the HTTP 200 response format.static AsyncSearchQueryResultfromHttp429(String payload)Creates a result out of the http 429 response code if retry didn't work.static AsyncSearchQueryResultfromIndexNotFound(String indexName)Deprecated.FTS is still in BETA so the response format is likely to change in a future version, and be unified with the HTTP 200 response format.static AsyncSearchQueryResultfromJson(JsonObject json)Deprecated.FTS is still in BETA so the response format is likely to change in a future versionrx.Observable<SearchQueryRow>hits()AnObservableofrows(or hits) describing each individual result.rx.Observable<SearchMetrics>metrics()AnObservableasynchronously providing statistics about the request in the form of a singleSearchMetrics.SearchStatusstatus()TheSearchStatusallows to check if the request was a full success (SearchStatus.isSuccess()) and gives more details about status for each queried index.
-
-
-
Constructor Detail
-
DefaultAsyncSearchQueryResult
public DefaultAsyncSearchQueryResult(SearchStatus status, rx.Observable<SearchQueryRow> hits, rx.Observable<FacetResult> facets, rx.Observable<SearchMetrics> metrics)
-
-
Method Detail
-
status
public SearchStatus status()
Description copied from interface:AsyncSearchQueryResultTheSearchStatusallows to check if the request was a full success (SearchStatus.isSuccess()) and gives more details about status for each queried index.- Specified by:
statusin interfaceAsyncSearchQueryResult
-
hits
public rx.Observable<SearchQueryRow> hits()
Description copied from interface:AsyncSearchQueryResultAnObservableofrows(or hits) describing each individual result. Note that in case of a partial success,Observer.onError(Throwable)will be called after each partial result has been emitted. In case of a full execution failure, no hit is emitted before the onError. The following execution-level exceptions can happen: - if there is one or more execution-level errors, each of them is represented as aRuntimeException, and all are aggregated into a singleCompositeException. - if the request is malformed, the server side error message is returned as the message of aCouchbaseException.- Specified by:
hitsin interfaceAsyncSearchQueryResult
-
facets
public rx.Observable<FacetResult> facets()
Description copied from interface:AsyncSearchQueryResultAnObservableemitting aFacetResultfor each requested facet in the original request.- Specified by:
facetsin interfaceAsyncSearchQueryResult
-
metrics
public rx.Observable<SearchMetrics> metrics()
Description copied from interface:AsyncSearchQueryResultAnObservableasynchronously providing statistics about the request in the form of a singleSearchMetrics. Note that the metrics are emitted after all hits have been received.- Specified by:
metricsin interfaceAsyncSearchQueryResult
-
fromJson
@Deprecated public static AsyncSearchQueryResult fromJson(JsonObject json)
Deprecated.FTS is still in BETA so the response format is likely to change in a future versionUtility method to extract anAsyncSearchQueryResultfrom a JSON representation of the whole search service response.- Parameters:
json- the whole response, as returned by the search service.- Returns:
- the corresponding
AsyncSearchQueryResult.
-
fromHttp400
@Deprecated public static AsyncSearchQueryResult fromHttp400(String payload)
Deprecated.FTS is still in BETA so the response format is likely to change in a future version, and be unified with the HTTP 200 response format.A utility method to convert an HTTP 400 response from the search service into a properAsyncSearchQueryResult. HTTP 400 indicates the request was malformed and couldn't be parsed on the server. As of Couchbase Server 4.5 such a response is a text/plain body that describes the parsing error. The whole body is emitted/thrown, wrapped in aFtsMalformedRequestException.- Parameters:
payload- the HTTP 400 response body describing the parsing failure.- Returns:
- an
AsyncSearchQueryResultthat will emit aFtsMalformedRequestExceptionwhen calling itshits()method.
-
fromHttp412
@Deprecated public static AsyncSearchQueryResult fromHttp412()
Deprecated.FTS is still in BETA so the response format is likely to change in a future version, and be unified with the HTTP 200 response format.A utility method to convert an HTTP 412 response from the search service into a properAsyncSearchQueryResult. HTTP 412 indicates the request couldn't be satisfied with given consistency before the timeout expired. This is translated to aFtsConsistencyTimeoutException.- Returns:
- an
AsyncSearchQueryResultthat will emit aFtsConsistencyTimeoutExceptionwhen calling itshits()method.
-
fromHttp429
public static AsyncSearchQueryResult fromHttp429(String payload)
Creates a result out of the http 429 response code if retry didn't work.
-
fromIndexNotFound
@Deprecated public static AsyncSearchQueryResult fromIndexNotFound(String indexName)
Deprecated.FTS is still in BETA so the response format is likely to change in a future version, and be unified with the HTTP 200 response format.A utility method to return a result when the index is not found.- Returns:
- an
AsyncSearchQueryResultthat will emit aIndexDoesNotExistExceptionwhen calling itshits()method.
-
-