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