Fix bug where a 'match all' VC is returned in case a bug in the input data is given
Change-Id: I8a64636fa00b86211fcb323143507aa5acaffac2
diff --git a/src/main/java/de/ids_mannheim/korap/KrillCollection.java b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
index e399264..b2d326e 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
@@ -98,18 +98,21 @@
}
else{
this.addError(StatusCodes.MISSING_COLLECTION, "Collection is not found.");
+ this.fromBuilder(this.build().nothing());
}
}
// Query Exception
catch (QueryException qe) {
this.addError(qe.getErrorCode(), qe.getMessage());
+ this.fromBuilder(this.build().nothing());
}
// JSON exception
catch (IOException e) {
this.addError(621, "Unable to parse JSON", "KrillCollection",
e.getLocalizedMessage());
+ this.fromBuilder(this.build().nothing());
};
};
@@ -140,6 +143,7 @@
}
catch (Exception e) {
this.addError(621, "Unable to parse JSON", "KrillCollection");
+ this.fromBuilder(this.build().nothing());
};
return this;
diff --git a/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java b/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
index d3ade8b..4716804 100644
--- a/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
@@ -51,6 +51,12 @@
return new CollectionBuilder.Range(field, since, KrillDate.END);
};
+ public CollectionBuilder.Interface nothing () {
+
+ // Requires that a field with name "0---" does not exist
+ return new CollectionBuilder.Term("0---", "0");
+ };
+
public CollectionBuilder.Interface till (String field, String date) {
try {
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 074fbae..1678d9e 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,4 +1,4 @@
-# log4j.rootLogger = ERROR, stdout
+log4j.rootLogger = ERROR, stdout
# Queries:
# log4j.logger.de.ids_mannheim.korap.query.SpanNextQuery = TRACE, stdout
@@ -32,7 +32,7 @@
# log4j.logger.de.ids_mannheim.korap.response.Match = TRACE, stdout
# Index:
-log4j.logger.de.ids_mannheim.korap.index.Indexer = INFO, stdout
+# log4j.logger.de.ids_mannheim.korap.index.Indexer = INFO, stdout
# log4j.logger.de.ids_mannheim.korap.KrillIndex = TRACE, stdout
# log4j.logger.de.ids_mannheim.korap.index.PositionsToOffset = TRACE, stdout
# log4j.logger.de.ids_mannheim.korap.index.MultiTermTokenStream = TRACE, stdout