Allow slicing for update-where et al
@@ -1052,9 +1052,6 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
if (cluster.isEmpty() && path.documentType().isEmpty())
throw new IllegalArgumentException("Must set 'cluster' parameter to a valid content cluster id when visiting at a root /document/v1/ level");
- Optional<Integer> slices = getProperty(request, SLICES, integerParser);
- Optional<Integer> sliceId = getProperty(request, SLICE_ID, integerParser);
-
VisitorParameters parameters = parseCommonParameters(request, path, cluster);
parameters.setFieldSet(getProperty(request, FIELD_SET).orElse(path.documentType().map(type -> type + ":[document]").orElse(AllFields.NAME)));
parameters.setMaxTotalHits(wantedDocumentCount);
@@ -1069,10 +1066,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
parameters.setThrottlePolicy(throttlePolicy);
parameters.visitInconsistentBuckets(true);
parameters.setSessionTimeoutMs(Math.max(1, request.getTimeout(TimeUnit.MILLISECONDS) - handlerTimeout.toMillis()));
- if (slices.isPresent() && sliceId.isPresent())
- parameters.slice(slices.get(), sliceId.get());
- else if (slices.isPresent() != sliceId.isPresent())
- throw new IllegalArgumentException("None or both of '" + SLICES + "' and '" + SLICE_ID + "' must be set");
+
return parameters;
}
@@ -1107,6 +1101,13 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
List.of(FixedBucketSpaces.defaultSpace(), FixedBucketSpaces.globalSpace()),
getProperty(request, BUCKET_SPACE)));
+ Optional<Integer> slices = getProperty(request, SLICES, integerParser);
+ Optional<Integer> sliceId = getProperty(request, SLICE_ID, integerParser);
+ if (slices.isPresent() && sliceId.isPresent())
+ parameters.slice(slices.get(), sliceId.get());
+ else if (slices.isPresent() != sliceId.isPresent())
+ throw new IllegalArgumentException("None or both of '" + SLICES + "' and '" + SLICE_ID + "' must be set");
+
return parameters;
}
