Added skip limit

This commit is contained in:
luca.frosini 2023-11-07 18:01:38 +01:00
parent 68c742eb09
commit b978185cd5
1 changed files with 11 additions and 9 deletions

View File

@ -123,21 +123,18 @@ public class JsonQuery {
offset = 0; offset = 0;
} }
/*
int position = -1; int position = -1;
int count = 0; int count = 0;
*/
StringBuffer stringBuffer = createQuery(); StringBuffer stringBuffer = createQuery();
/* stringBuffer.append(" SKIP :offset");
* TRAVERSE does not support SKIP stringBuffer.append(" LIMIT :limit");
* so we need to use post filtering strategy
*/
// stringBuffer.append(" SKIP :offset");
// stringBuffer.append(" LIMIT :limit");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
// map.put("offset", offset); map.put("offset", offset);
// map.put("limit", limit); map.put("limit", limit);
String query = stringBuffer.toString(); String query = stringBuffer.toString();
@ -149,9 +146,12 @@ public class JsonQuery {
while(resultSet.hasNext()) { while(resultSet.hasNext()) {
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
/*
if(++position < offset) { if(++position < offset) {
continue; continue;
} }
*/
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement()); OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
try { try {
@ -161,9 +161,11 @@ public class JsonQuery {
erManagement.setAsEntryPoint(); erManagement.setAsEntryPoint();
jsonNodeResult = erManagement.serializeAsJsonNode(); jsonNodeResult = erManagement.serializeAsJsonNode();
arrayNode.add(jsonNodeResult); arrayNode.add(jsonNodeResult);
/*
if(limit > 0 && ++count >= limit) { if(limit > 0 && ++count >= limit) {
break; break;
} }
*/
/* /*