Class Results<T> (2.0.0)

public class Results<T> implements Iterable<T>, Serializable

Represents a result of executing a search. The Results include an OperationResult, a collection of results, and a number of found and returned results.

Inheritance

java.lang.Object > Results<T>

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 OperationResult

the result of the search operation

results Collection<T>

a collection of results that resulted from the search

numberFound long

the number of results found by the search

numberReturned int

the number of results returned

cursor Cursor

the 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 OperationResult

the result of the search operation

results Collection<T>

a collection of results that resulted from the search

numberFound long

the number of results found by the search

numberReturned int

the number of results returned

cursor Cursor

the 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 null if there are no more results to be expected or if no cursor was configured in the QueryOptions.

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
Overrides