public class Results<T> implements Iterable<T>, SerializableRepresents a result of executing a search. The Results include an OperationResult, a collection of results, and a number of found and returned results.
Type Parameter |
|
|---|---|
| Name | Description |
T |
|
Constructors
Results(OperationResult operationResult, Collection<T> results, long numberFound, int numberReturned, Cursor cursor)
protected Results(OperationResult operationResult, Collection<T> results, long numberFound, int numberReturned, Cursor cursor)Creates a Results by specifying a collection of search results, the number of results found, and the number of results returned.
| Parameters | |
|---|---|
| Name | Description |
operationResult |
OperationResultthe result of the search operation |
results |
Collection<T>a collection of results that resulted from the search |
numberFound |
longthe number of results found by the search |
numberReturned |
intthe number of results returned |
cursor |
Cursorthe Cursor if there are more results and user requested it |
Results(OperationResult operationResult, Collection<T> results, long numberFound, int numberReturned, Cursor cursor, Collection<FacetResult> facets)
protected Results(OperationResult operationResult, Collection<T> results, long numberFound, int numberReturned, Cursor cursor, Collection<FacetResult> facets)Creates a Results by specifying a collection of search results, the number of results found, and the number of results returned.
| Parameters | |
|---|---|
| Name | Description |
operationResult |
OperationResultthe result of the search operation |
results |
Collection<T>a collection of results that resulted from the search |
numberFound |
longthe number of results found by the search |
numberReturned |
intthe number of results returned |
cursor |
Cursorthe Cursor if there are more results and user requested it |
facets |
Collection<FacetResult>aggregated facets of this search results as a collection of FacetResult from the search |
Methods
getCursor()
public Cursor getCursor()A cursor to be used to continue the search after all the results
in this search response. For this field to be populated,
use QueryOptions.Builder#setCursor with a value of
Cursor.newBuilder().build(), otherwise #getCursor
will return null.
| Returns | |
|---|---|
| Type | Description |
Cursor |
cursor to be used to get the next set of results after the
end of these results, or |
getFacets()
public Collection<FacetResult> getFacets()| Returns | |
|---|---|
| Type | Description |
Collection<FacetResult> |
an unmodifiable collection of aggregated facets for this search results |
getNumberFound()
public long getNumberFound()The number of results found by the search. If the value is less than or equal to the corresponding QueryOptions#getNumberFoundAccuracy(), then it is accurate, otherwise it is an approximation
| Returns | |
|---|---|
| Type | Description |
long |
the number of results found |
getNumberReturned()
public int getNumberReturned()| Returns | |
|---|---|
| Type | Description |
int |
the number of results returned |
getOperationResult()
public OperationResult getOperationResult()| Returns | |
|---|---|
| Type | Description |
OperationResult |
the result of the search operation |
getResults()
public Collection<T> getResults()| Returns | |
|---|---|
| Type | Description |
Collection<T> |
an unmodifiable collection of search results |
iterator()
public Iterator<T> iterator()| Returns | |
|---|---|
| Type | Description |
Iterator<T> |
|
toString()
public String toString()| Returns | |
|---|---|
| Type | Description |
String |
|