Get Query Statistics
Query statistics can provide important information about a query like duration, total number of results, staleness information, etc. To access statistics use the statistics
method.
Syntax
IDocumentQuery<T> statistics(Reference<QueryStatistics> stats);
Parameters | ||
---|---|---|
stats | QueryStatistics |
Statistics for query. |
Example
Reference<QueryStatistics> stats = new Reference<>();
List<Employee> employees = session.query(Employee.class)
.whereEquals("FirstName", "Robert")
.statistics(stats)
.toList();
int totalResults = stats.value.getTotalResults();
long durationInMs = stats.value.getDurationInMs();