Better coverage of new vc API
diff --git a/src/main/java/de/ids_mannheim/korap/KorapFilter.java b/src/main/java/de/ids_mannheim/korap/KorapFilter.java
index 55ad51f..ac23ae9 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapFilter.java
@@ -3,6 +3,7 @@
 import de.ids_mannheim.korap.filter.BooleanFilter;
 import de.ids_mannheim.korap.filter.RegexFilter;
 import de.ids_mannheim.korap.util.QueryException;
+import de.ids_mannheim.korap.util.KorapDate;
 
 import org.apache.lucene.search.Query;
 
@@ -93,6 +94,7 @@
     };
 
     protected BooleanFilter fromJSON (JsonNode json, String field) throws QueryException {
+	BooleanFilter bfilter = new BooleanFilter();
 	String type = json.get("@type").asText();
 
 	// Single filter
@@ -110,29 +112,59 @@
 
 	    // Filter based on date
 	    if (valtype.equals("type:date")) {
-		String date = json.get("value").asText();
+		String dateStr = json.get("value").asText();
 		if (json.has("match"))
 		    match = json.get("match").asText();
 
-
 		// TODO: This isn't stable yet
 		switch (match) {
 		case "match:eq":
-		    filter.date(date);
+		    bfilter.date(dateStr);
+		    break;
 		case "match:geq":
-		    filter.since(date);
+		    bfilter.since(dateStr);
+		    break;
 		case "match:leq":
-		    filter.till(date);
+		    bfilter.till(dateStr);
+		    break;
 		};
 		/*
 		  No good reason for gt or lt
 		*/
-		return filter;
+		return bfilter;
+	    }
+	    else if (valtype.equals("type:string")) {
+		if (json.has("match"))
+		    match = json.get("match").asText();
+
+		if (match.equals("match:eq")) {
+		    bfilter.and(key, json.get("value").asText());
+		};
+		return bfilter;
 	    };
 	}
 
 	// nested group
 	else if (type.equals("korap:docGroup")) {
+	    String operation = "operation:and";
+	    if (json.has("operation"))
+		operation = json.get("operation").asText();
+
+	    BooleanFilter group = new BooleanFilter();
+
+	    for (JsonNode operand : json.get("operands")) {
+		if (operation.equals("operation:and")) {
+		    group.and(this.fromJSON(operand, field));
+		}
+		else if (operation.equals("operation:or")) {
+		    group.or(this.fromJSON(operand, field));
+		}
+		else {
+		    throw new QueryException(613, "Unknown docGroup operation");
+		};
+	    };
+	    bfilter.and(group);
+	    return bfilter;
 	}
 
 	// UNknown type
@@ -160,7 +192,7 @@
     //    };
     
     protected BooleanFilter fromJSONLegacy (JsonNode json, String field) throws QueryException {
-	BooleanFilter filter = new BooleanFilter();
+	BooleanFilter bfilter = new BooleanFilter();
 	
 	String type = json.get("@type").asText();
 
@@ -172,14 +204,14 @@
 
 	if (type.equals("korap:term")) {
 	    if (field != null && json.has("@value"))
-		filter.and(field, json.get("@value").asText());
-	    return filter;
+		bfilter.and(field, json.get("@value").asText());
+	    return bfilter;
 	}
 	else if (type.equals("korap:group")) {
 	    if (!json.has("relation") || !json.has("operands"))
-		return filter;
+		return bfilter;
 
-	    String date, till;
+	    String dateStr, till;
 
 	    if (DEBUG)
 		log.trace("relation: " + json.get("relation").asText());
@@ -188,42 +220,42 @@
 	    
 	    switch (json.get("relation").asText())  {
 	    case "between":
-		date = _getDateLegacy(json, 0);
+		dateStr = _getDateLegacy(json, 0);
 		till = _getDateLegacy(json, 1);
-		if (date != null && till != null)
-		    filter.between(date, till);
+		if (dateStr != null && till != null)
+		    bfilter.between(dateStr, till);
 		break;
 
 	    case "until":
-		date = _getDateLegacy(json, 0);
-		if (date != null)
-		    filter.till(date);
+		dateStr = _getDateLegacy(json, 0);
+		if (dateStr != null)
+		    bfilter.till(dateStr);
 		break;
 
 	    case "since":
-		date = _getDateLegacy(json, 0);
-		if (date != null)
-		    filter.since(date);
+		dateStr = _getDateLegacy(json, 0);
+		if (dateStr != null)
+		    bfilter.since(dateStr);
 		break;
 
 	    case "equals":
-		date = _getDateLegacy(json, 0);
-		if (date != null)
-		    filter.date(date);
+		dateStr = _getDateLegacy(json, 0);
+		if (dateStr != null)
+		    bfilter.date(dateStr);
 		break;
 
 	    case "and":
 		for (JsonNode operand : json.get("operands")) {
 		    group.and(this.fromJSONLegacy(operand, field));
 		};
-		filter.and(group);
+		bfilter.and(group);
 		break;
 
 	    case "or":
 		for (JsonNode operand : json.get("operands")) {
 		    group.or(this.fromJSONLegacy(operand, field));
 		};
-		filter.and(group);
+		bfilter.and(group);
 		break;
 
 	    default:
@@ -235,7 +267,7 @@
 	else {
 	    throw new QueryException(type + " is not a supported group");
 	};
-	return filter;
+	return bfilter;
     };
     
 
diff --git a/src/main/java/de/ids_mannheim/korap/filter/BooleanFilter.java b/src/main/java/de/ids_mannheim/korap/filter/BooleanFilter.java
index fecfd46..ec04226 100644
--- a/src/main/java/de/ids_mannheim/korap/filter/BooleanFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/filter/BooleanFilter.java
@@ -123,8 +123,8 @@
 	return this;
     };
 
-    public BooleanFilter since (String date) {
-	int since = new KorapDate(date).floor();
+    public BooleanFilter since (String dateStr) {
+	int since = new KorapDate(dateStr).floor();
 
 	if (since == 0 || since == KorapDate.BEGINNING)
 	    return this;
@@ -144,9 +144,9 @@
     };
 
 
-    public BooleanFilter till (String date) {
+    public BooleanFilter till (String dateStr) {
 	try {
-	    int till =  new KorapDate(date).ceil();
+	    int till =  new KorapDate(dateStr).ceil();
 	    if (till == 0 || till == KorapDate.END)
 		return this;
 
@@ -200,8 +200,8 @@
     };
 
 
-    public BooleanFilter date (String date) {
-	KorapDate dateDF = new KorapDate(date);
+    public BooleanFilter date (String dateStr) {
+	KorapDate dateDF = new KorapDate(dateStr);
 
 	if (dateDF.year() == 0)
 	    return this;
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKorapCollectionJSON.java b/src/test/java/de/ids_mannheim/korap/collection/TestKorapCollectionJSON.java
index 910f574..963ef47 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKorapCollectionJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKorapCollectionJSON.java
@@ -22,7 +22,28 @@
     public void collection1 () {
 	String metaQuery = _getJSONString("collection_1.jsonld");
 	KorapCollection kc = new KorapCollection(metaQuery);
-	System.err.println(kc.toString());
+	assertEquals(kc.toString(), "filter with QueryWrapperFilter(+pubDate:20000101); ");
+    };
+
+    @Test
+    public void collection2 () {
+	String metaQuery = _getJSONString("collection_2.jsonld");
+	KorapCollection kc = new KorapCollection(metaQuery);
+	assertEquals(kc.toString(), "filter with QueryWrapperFilter(+(+pubDate:[19900000 TO 99999999] +pubDate:[0 TO 20061099])); ");
+    };
+
+    @Test
+    public void collection3 () {
+	String metaQuery = _getJSONString("collection_3.jsonld");
+	KorapCollection kc = new KorapCollection(metaQuery);
+	assertEquals(kc.toString(), "");
+    };
+
+    @Test
+    public void collection5 () {
+	String metaQuery = _getJSONString("collection_5.jsonld");
+	KorapCollection kc = new KorapCollection(metaQuery);
+	assertEquals(kc.toString(), "filter with QueryWrapperFilter(+(pubDate:[19900000 TO 99999999] title:Mannheim)); ");
     };
 
     private String _getJSONString (String file) {
diff --git a/src/test/resources/queries/collections/collection_2.jsonld b/src/test/resources/queries/collections/collection_2.jsonld
index c6c39f4..52086b8 100644
--- a/src/test/resources/queries/collections/collection_2.jsonld
+++ b/src/test/resources/queries/collections/collection_2.jsonld
@@ -16,7 +16,7 @@
       "@type" : "korap:doc",
       "key" : "pubDate",
       "type" : "type:date",
-      "value" : "2006",
+      "value" : "2006-10",
       "match" : "match:leq"
     } ]
   }
diff --git a/src/test/resources/queries/collections/collection_5.jsonld b/src/test/resources/queries/collections/collection_5.jsonld
new file mode 100644
index 0000000..7c1b4f6
--- /dev/null
+++ b/src/test/resources/queries/collections/collection_5.jsonld
@@ -0,0 +1,23 @@
+{
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+  "errors" : [ ],
+  "warnings" : [ ],
+  "announcements" : [ ],
+  "collection" : {
+    "@type" : "korap:docGroup",
+    "operation" : "operation:or",
+    "operands" : [ {
+      "@type" : "korap:doc",
+      "key" : "pubDate",
+      "type" : "type:date",
+      "value" : "1990",
+      "match" : "match:geq"
+    }, {
+      "@type" : "korap:doc",
+      "key" : "title",
+      "type" : "type:string",
+      "value" : "Mannheim",
+      "match" : "match:eq"
+    } ]
+  }
+}
\ No newline at end of file