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 an
AsyncSearchQueryResult
- 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
Modifier and Type Method Description rx.Observable<FacetResult>
facets()
AnObservable
emitting aFacetResult
for each requested facet in the original request.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.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.static AsyncSearchQueryResult
fromHttp429(String payload)
Creates a result out of the http 429 response code if retry didn't work.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.static AsyncSearchQueryResult
fromJson(JsonObject json)
Deprecated.FTS is still in BETA so the response format is likely to change in a future versionrx.Observable<SearchQueryRow>
hits()
AnObservable
ofrows
(or hits) describing each individual result.rx.Observable<SearchMetrics>
metrics()
AnObservable
asynchronously providing statistics about the request in the form of a singleSearchMetrics
.SearchStatus
status()
TheSearchStatus
allows to check if the request was a full success (SearchStatus.isSuccess()
) and gives more details about status for each queried index.
-
Constructor Details
-
DefaultAsyncSearchQueryResult
public DefaultAsyncSearchQueryResult(SearchStatus status, rx.Observable<SearchQueryRow> hits, rx.Observable<FacetResult> facets, rx.Observable<SearchMetrics> metrics)
-
-
Method Details
-
status
Description copied from interface:AsyncSearchQueryResult
TheSearchStatus
allows to check if the request was a full success (SearchStatus.isSuccess()
) and gives more details about status for each queried index.- Specified by:
status
in interfaceAsyncSearchQueryResult
-
hits
Description copied from interface:AsyncSearchQueryResult
AnObservable
ofrows
(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:
hits
in interfaceAsyncSearchQueryResult
-
facets
Description copied from interface:AsyncSearchQueryResult
AnObservable
emitting aFacetResult
for each requested facet in the original request.- Specified by:
facets
in interfaceAsyncSearchQueryResult
-
metrics
Description copied from interface:AsyncSearchQueryResult
AnObservable
asynchronously 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:
metrics
in interfaceAsyncSearchQueryResult
-
fromJson
Deprecated.FTS is still in BETA so the response format is likely to change in a future versionUtility method to extract anAsyncSearchQueryResult
from 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.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
AsyncSearchQueryResult
that will emit aFtsMalformedRequestException
when calling itshits()
method.
-
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
AsyncSearchQueryResult
that will emit aFtsConsistencyTimeoutException
when calling itshits()
method.
-
fromHttp429
Creates a result out of the http 429 response code if retry didn't work. -
fromIndexNotFound
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
AsyncSearchQueryResult
that will emit aIndexDoesNotExistException
when calling itshits()
method.
-