Addded a no-need-for-rewrite test.
Change-Id: I4441689d7534d79deb37ec357948bf6a6769433f
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java
index 54e4e2e..189cdd5 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java
@@ -91,10 +91,10 @@
userAvailabilities = checkAvailability(jsonNode.at("/collection"), userAvailabilities);
if (!userAvailabilities.isEmpty()){
builder.with(buildAvailability(userAvailabilities));
+ builder.setBaseQuery(builder.toJSON());
+ rewrittesNode = builder.mergeWith(jsonNode).at("/collection");
+ node.set("collection", rewrittesNode, identifier);
}
- builder.setBaseQuery(builder.toJSON());
- rewrittesNode = builder.mergeWith(jsonNode).at("/collection");
- node.set("collection", rewrittesNode, identifier);
}
else {
builder.with(buildAvailability(userAvailabilities));