summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
diff options
context:
space:
mode:
authorHaakon Dybdahl <dybdahl@yahoo-inc.com>2017-01-26 10:59:59 +0100
committerHaakon Dybdahl <dybdahl@yahoo-inc.com>2017-01-26 10:59:59 +0100
commitc11149b34d075cae83741ab80d6195fe0254e5b0 (patch)
treeb6d326f51067d9d2dab8d122bc7418dadc264547 /vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
parent8b378f8d90ed92fc826c0113a2e00123839429f3 (diff)
Allow visiting based on group selection automatically.
Diffstat (limited to 'vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
index f6a6ed05e57..18628af3eca 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
@@ -204,14 +204,16 @@ public class RestApi extends LoggingRequestHandler {
}
private HttpResponse handleVisit(RestUri restUri, HttpRequest request) throws RestApiException {
+ String documentSelection = Optional.ofNullable(request.getProperty(SELECTION)).orElse("");
if (restUri.getGroup().isPresent() && ! restUri.getGroup().get().value.isEmpty()) {
- return Response.createErrorResponse(
- 400,
- "Visiting does not support setting value for group/value, try using expression parameter instead.",
- restUri);
-
+ if (! documentSelection.isEmpty()) {
+ return Response.createErrorResponse(
+ 400,
+ "Visiting does not support setting value for group/value in combination with expression, try using only expression parameter instead.",
+ restUri);
+ }
+ documentSelection = "id.group='" + restUri.getGroup().get().value + "'";
}
- String documentSelection = Optional.ofNullable(request.getProperty(SELECTION)).orElse("");
Optional<String> cluster = Optional.ofNullable(request.getProperty(CLUSTER));
Optional<String> continuation = Optional.ofNullable(request.getProperty(CONTINUATION));
final OperationHandler.VisitResult visit = operationHandler.visit(restUri, documentSelection, cluster, continuation);