Skip to content

Instantly share code, notes, and snippets.

@mverzilli
Last active December 24, 2015 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mverzilli/6873028 to your computer and use it in GitHub Desktop.
Save mverzilli/6873028 to your computer and use it in GitHub Desktop.
Limit number of results shown in "MyReportsView"
public class AllReportsByTimestampDesc extends UnicefGisView {
...
...
...
public List<Map<String, Object>> query() {
view.updateIndex();
CBLQueryOptions options = new CBLQueryOptions();
options.setDescending(true);
CBLStatus status = new CBLStatus();
//En lugar de retornar el resultado de la query como viene,
//recortá la lista para devolver las primeras N posiciones
//(supongo que con N=30 no complicamos el uso
//y la memoria debería bancársela de sobra)
return view.queryWithOptions(options, status);
}
...
...
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment