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 aList
of 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
).SearchMetrics
metrics()
Provides aSearchMetrics
object giving statistics on the request like number of hits, total time taken...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.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:SearchQueryResult
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 interfaceSearchQueryResult
-
hits
Description copied from interface:SearchQueryResult
The 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:
hits
in 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:SearchQueryResult
The list of FTS result rows, or "hits", for the FTS query. In case of an execution error (eg. partial results), aCompositeException
is thrown instead.- Specified by:
hitsOrFail
in 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:SearchQueryResult
Returns 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:
iterator
in interfaceIterable<SearchQueryRow>
- Specified by:
iterator
in interfaceSearchQueryResult
- Returns:
- an Iterator of rows/hits.
-
errors
Description copied from interface:SearchQueryResult
When an execution error happens (including partial results), this method returns aList
of the error(s) inJSON format
. -
facets
Description copied from interface:SearchQueryResult
If 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:
facets
in interfaceSearchQueryResult
-
metrics
Description copied from interface:SearchQueryResult
Provides aSearchMetrics
object giving statistics on the request like number of hits, total time taken...- Specified by:
metrics
in interfaceSearchQueryResult
-
toString
-