@InterfaceStability.Experimental @InterfaceAudience.Public public class DefaultSearchQueryResult extends Object implements SearchQueryResult
The default implementation for a SearchQueryResult
Modifier and Type | Field and Description |
---|---|
static Func1<AsyncSearchQueryResult,Observable<SearchQueryResult>> |
FROM_ASYNC
|
Constructor and Description |
---|
DefaultSearchQueryResult(SearchStatus status,
List<SearchQueryRow> hits,
Throwable error,
Map<String,FacetResult> facets,
SearchMetrics metrics) |
Modifier and Type | Method and Description |
---|---|
List<String> |
errors()
When an execution error happens (including partial results), this method returns a
List of the error(s) in JSON format . |
Map<String,FacetResult> |
facets()
If one or more facet were requested via the
SearchQuery#addFacets(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 a
SearchMetrics object giving statistics on the request like number of hits, total time taken… |
SearchStatus |
status()
The
SearchStatus allows to check if the request was a full success (SearchStatus.isSuccess() ) and gives more details about status for each queried index. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final Func1<AsyncSearchQueryResult,Observable<SearchQueryResult>> FROM_ASYNC
Utility Func1
to convert an AsyncSearchQueryResult
into a synchronous SearchQueryResult
.
public DefaultSearchQueryResult(SearchStatus status, List<SearchQueryRow> hits, Throwable error, Map<String,FacetResult> facets, SearchMetrics metrics)
public SearchStatus status()
SearchQueryResult
The SearchStatus
allows to check if the request was a full success (SearchStatus.isSuccess()
) and gives more details about status for each queried index.
status
in interface SearchQueryResult
public List<SearchQueryRow> hits()
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.
hits
in interface SearchQueryResult
for a variant that throws an exception whenever execution errors have occurred.
,
to get a list of execution errors in JSON form.
public List<SearchQueryRow> hitsOrFail()
SearchQueryResult
The list of FTS result rows, or “hits”, for the FTS query. In case of an execution error (eg. partial results), a CompositeException
is thrown instead.
hitsOrFail
in interface SearchQueryResult
for a variant that lists partial results instead of throwing the exception.
,
to get a list of execution errors in JSON form.
public Iterator<SearchQueryRow> iterator()
SearchQueryResult
Returns an iterator over the hits (SearchQueryRow
). If an execution error happened, the corresponding exception is thrown instead (same as attempting to iterate over SearchQueryResult.hitsOrFail()
).
iterator
in interface SearchQueryResult
iterator
in interface Iterable<SearchQueryRow>
public List<String> errors()
SearchQueryResult
When an execution error happens (including partial results), this method returns a List
of the error(s) in JSON format
.
public Map<String,FacetResult> facets()
SearchQueryResult
If one or more facet were requested via the SearchQuery#addFacets(SearchFacet...)
method when querying, contains the result of each facet. The map keys are the names given to each requested facet.
facets
in interface SearchQueryResult
public SearchMetrics metrics()
SearchQueryResult
Provides a SearchMetrics
object giving statistics on the request like number of hits, total time taken…
metrics
in interface SearchQueryResult
Copyright © 2015 Couchbase, Inc.