Fixed empty user availabilities.
Change-Id: I8efe10fa3adbf3452e026024cc970b91e9c6f174
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 189cdd5..4a5ff06 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
@@ -46,8 +46,7 @@
&& node.at("/key").asText().equals("availability")) {
String queryAvailability = node.at("/value").asText();
String matchOp = node.at("/match").asText();
- if (userAvailabilities.contains(queryAvailability) && matchOp.
- equals(KoralMatchOperator.EQUALS.toString())){
+ if (!userAvailabilities.contains(queryAvailability)){
userAvailabilities.remove(queryAvailability);
}
}
@@ -91,10 +90,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));