Class DefaultSearchQueryResult
java.lang.Object
com.couchbase.client.java.search.result.impl.DefaultSearchQueryResult
- All Implemented Interfaces:
SearchQueryResult,Iterable<SearchQueryRow>
@Committed @Public public class DefaultSearchQueryResult extends Object implements SearchQueryResult
The default implementation for a
SearchQueryResult- Since:
- 2.3.0
- Author:
- Simon Baslé, Michael Nitschinger
-
Field Summary
Fields Modifier and Type Field Description static rx.functions.Func1<AsyncSearchQueryResult,rx.Observable<SearchQueryResult>>FROM_ASYNC -
Constructor Summary
Constructors Constructor Description DefaultSearchQueryResult(SearchStatus status, List<SearchQueryRow> hits, Throwable error, Map<String,FacetResult> facets, SearchMetrics metrics) -
Method Summary
Modifier and Type Method Description List<String>errors()When an execution error happens (including partial results), this method returns aListof the error(s) inJSON format.Map<String,FacetResult>facets()If one or more facet were requested via theSearchQuery.addFacet(String, SearchFacet)method when querying, contains the result of each facet.List<SearchQueryRow>hits()The list of FTS result rows, or "hits", for the FTS query.List<SearchQueryRow>hitsOrFail()The list of FTS result rows, or "hits", for the FTS query.Iterator<SearchQueryRow>iterator()Returns an iterator over the hits (SearchQueryRow).SearchMetricsmetrics()Provides aSearchMetricsobject giving statistics on the request like number of hits, total time taken...SearchStatusstatus()TheSearchStatusallows to check if the request was a full success (SearchStatus.isSuccess()) and gives more details about status for each queried index.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
FROM_ASYNC
public static final rx.functions.Func1<AsyncSearchQueryResult,rx.Observable<SearchQueryResult>> FROM_ASYNC
-
-
Constructor Details
-
DefaultSearchQueryResult
public DefaultSearchQueryResult(SearchStatus status, List<SearchQueryRow> hits, Throwable error, Map<String,FacetResult> facets, SearchMetrics metrics)
-
-
Method Details
-
status
Description copied from interface:SearchQueryResultTheSearchStatusallows to check if the request was a full success (SearchStatus.isSuccess()) and gives more details about status for each queried index.- Specified by:
statusin interfaceSearchQueryResult
-
hits
Description copied from interface:SearchQueryResultThe list of FTS result rows, or "hits", for the FTS query. This method always returns a list, including when an execution error (eg. partial results) occurred.- Specified by:
hitsin interfaceSearchQueryResult- See Also:
for a variant that throws an exception whenever execution errors have occurred.,to get a list of execution errors in JSON form.
-
hitsOrFail
Description copied from interface:SearchQueryResultThe list of FTS result rows, or "hits", for the FTS query. In case of an execution error (eg. partial results), aCompositeExceptionis thrown instead.- Specified by:
hitsOrFailin interfaceSearchQueryResult- See Also:
for a variant that lists partial results instead of throwing the exception.,to get a list of execution errors in JSON form.
-
iterator
Description copied from interface:SearchQueryResultReturns an iterator over the hits (SearchQueryRow). If an execution error happened, the corresponding exception is thrown instead (same as attempting to iterate overSearchQueryResult.hitsOrFail()).- Specified by:
iteratorin interfaceIterable<SearchQueryRow>- Specified by:
iteratorin interfaceSearchQueryResult- Returns:
- an Iterator of rows/hits.
-
errors
Description copied from interface:SearchQueryResultWhen an execution error happens (including partial results), this method returns aListof the error(s) inJSON format. -
facets
Description copied from interface:SearchQueryResultIf one or more facet were requested via theSearchQuery.addFacet(String, SearchFacet)method when querying, contains the result of each facet.The map keys are the names given to each requested facet.
- Specified by:
facetsin interfaceSearchQueryResult
-
metrics
Description copied from interface:SearchQueryResultProvides aSearchMetricsobject giving statistics on the request like number of hits, total time taken...- Specified by:
metricsin interfaceSearchQueryResult
-
toString
-