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

NameDescription
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
NameDescription
operationResultOperationResult

the result of the search operation

resultsCollection<T>

a collection of results that resulted from the search

numberFoundlong

the number of results found by the search

numberReturnedint

the number of results returned

cursorCursor

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
NameDescription
operationResultOperationResult

the result of the search operation

resultsCollection<T>

a collection of results that resulted from the search

numberFoundlong

the number of results found by the search

numberReturnedint

the number of results returned

cursorCursor

the Cursor if there are more results and user requested it

facetsCollection<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
TypeDescription
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
TypeDescription
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
TypeDescription
long

the number of results found

getNumberReturned()

public int getNumberReturned()
Returns
TypeDescription
int

the number of results returned

getOperationResult()

public OperationResult getOperationResult()
Returns
TypeDescription
OperationResult

the result of the search operation

getResults()

public Collection<T> getResults()
Returns
TypeDescription
Collection<T>

an unmodifiable collection of search results

iterator()

public Iterator<T> iterator()
Returns
TypeDescription
Iterator<T>

toString()

public String toString()
Returns
TypeDescription
String
Overrides