Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed pagination bug on deleted entities

  • Loading branch information...
commit eae3ebb6ec7a674ae5b3eb7e1a77aeb59f01d11b 1 parent dc21382
@michelegonella authored
View
14 zen-store/src/main/java/com/nominanuda/solr/DataImportHandlerWs.java
@@ -110,13 +110,6 @@ public HttpResponse handle(HttpRequest request) throws Exception {
}
}
}
- if (resultsArray.getLength() == rows) {
- Integer nextStart = start + rows;
- DataObject hasMore = resultsArray.addNewObject();
- hasMore.put(idField, "1");
- hasMore.put("hasMore", true);
- hasMore.put("nextUrl", computeNextUrl(cmd, nextStart));
- }
DataArray deletedEntities = computeDeleted(cmd, type_, since, start, rows);
for (Object o : deletedEntities) {
DataObject obj = STRUCT.newObject();
@@ -124,6 +117,13 @@ public HttpResponse handle(HttpRequest request) throws Exception {
obj.put("deleteDocById", o.toString());
resultsArray.add(obj);
}
+ if (resultsArray.getLength() >= rows || deletedEntities.getLength() >= rows) {
+ Integer nextStart = start + rows;
+ DataObject hasMore = resultsArray.addNewObject();
+ hasMore.put(idField, "1");
+ hasMore.put("hasMore", true);
+ hasMore.put("nextUrl", computeNextUrl(cmd, nextStart));
+ }
String message = toXml(STRUCT.newObject().with(resultsTag, resultsArray));
HttpResponse resp = HTTP.createBasicResponse(200, message,
CT_APPLICATION_XML_CS_UTF8);
Please sign in to comment.
Something went wrong with that request. Please try again.