You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See discussion in forum:
https://groups.google.com/forum/#!topic/cqengine-discuss/o4oUCc-PGOA
It would be nice if CQEngine had an explicit way to limit the number of results
returned. Currently, the application can just stop iterating when it has enough
results. But built-in support might be useful as an alternative.
Possible approach:
ResultSet<Car> results = cars.retrieve(equal(Car.MANUFACTURER, "Ford"),
queryOptions(limit(20)));
However, then support for pagination would seem like a good idea, but the limit
approach would be inefficient as it would require re-starting the query for the
second page.
Efficient pagination approach:
ResultSet<Car> results = cars.retrieve(equal(Car.MANUFACTURER, "Ford")); //
cache this
for (Car car : Pagination.limit(results, 20)) { // Advances through the first
20 cars
// Process the first 20 cars
}
for (Car car : Pagination.limit(results, 20)) { // Advances through the next 20
cars
// Process the next 20 cars
}
Original issue reported on code.google.com by ni...@npgall.com on 28 Aug 2013 at 1:38
The text was updated successfully, but these errors were encountered:
Pagination would be a common requirement for large collection. In addition to
sequential paging as shown in the example, arbitrary start positions should be
supported: Pagination(results, 20, 20) [ start at position 20 (1 based) and
return 20 records).
Guava's Iterable and FluentIterable interfaces support such pagination and
could be used to wrap a ResultSet.
Original comment by wilson.k...@gmail.com on 22 Jan 2015 at 9:51
Original issue reported on code.google.com by
ni...@npgall.com
on 28 Aug 2013 at 1:38The text was updated successfully, but these errors were encountered: