Support for 'or' and nested groups in collections
diff --git a/src/test/resources/queries/metaquery7.jsonld b/src/test/resources/queries/metaquery7.jsonld
new file mode 100644
index 0000000..a7114e6
--- /dev/null
+++ b/src/test/resources/queries/metaquery7.jsonld
@@ -0,0 +1,60 @@
+{
+    "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "meta":{
+	"startPage" : 1,
+	"count" : 5,
+	"context" : {
+	    "left" : [ "token", 3 ],
+	    "right" : [ "char", 6 ]
+	}
+    },
+    "query":{
+	"@type":"korap:token",
+	"wrap":{
+	    "@type":"korap:term",
+	    "foundry":"mate",
+	    "layer":"l",
+	    "key":"lediglich"
+	}
+    },
+    "collections": [
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#corpusID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "c-1"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "c-2"
+		    }
+		]
+	    }
+	},
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "and",
+		"@field": "korap:field#corpusID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "d-1"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "d-2"
+		    }
+		]
+	    }
+	}
+    ]
+}
diff --git a/src/test/resources/queries/metaquery8-filtered-further.jsonld b/src/test/resources/queries/metaquery8-filtered-further.jsonld
new file mode 100644
index 0000000..945a2fa
--- /dev/null
+++ b/src/test/resources/queries/metaquery8-filtered-further.jsonld
@@ -0,0 +1,80 @@
+{
+    "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:token", 
+	"wrap": {
+	    "@type": "korap:term", 
+	    "foundry": "mate",
+	    "layer" : "lemma",
+	    "key":"der", 
+	    "match": "match:eq"
+	}
+    },
+    "meta":{
+	"startPage":1,
+	"count": 10,
+	"context":{
+	    "left":["char",90],
+	    "right":["char",90]
+	}
+    },
+    "collections": [
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00001"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00002"
+		    }
+		]
+	    }
+	},
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00003"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00002"
+		    }
+		]
+	    }
+	},
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00001"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00005"
+		    }
+		]
+	    }
+	}
+    ]
+}
diff --git a/src/test/resources/queries/metaquery8-filtered-nested.jsonld b/src/test/resources/queries/metaquery8-filtered-nested.jsonld
new file mode 100644
index 0000000..ebb56ab
--- /dev/null
+++ b/src/test/resources/queries/metaquery8-filtered-nested.jsonld
@@ -0,0 +1,73 @@
+{
+    "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:token", 
+	"wrap": {
+	    "@type": "korap:term", 
+	    "foundry": "mate",
+	    "layer" : "lemma",
+	    "key":"der", 
+	    "match": "match:eq"
+	}
+    },
+    "meta":{
+	"startPage":1,
+	"count": 10,
+	"context":{
+	    "left":["char",90],
+	    "right":["char",90]
+	}
+    },
+    "collections": [
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00001"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00002"
+		    }
+		]
+	    }
+	},
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00003"
+		    },
+		    {
+			"@type": "korap:group",
+			"relation": "and",
+			"@field": "korap:field#tokens",
+			"operands": [
+			    {
+				"@type": "korap:term",
+				"@value": "s:die"
+			    },
+			    {
+				"@type": "korap:term",
+				"@value": "s:Schriftzeichen"
+			    }
+
+			]
+		    }
+		]
+	    }
+	}
+    ]
+}
diff --git a/src/test/resources/queries/metaquery8-filtered.jsonld b/src/test/resources/queries/metaquery8-filtered.jsonld
new file mode 100644
index 0000000..ddb51cf
--- /dev/null
+++ b/src/test/resources/queries/metaquery8-filtered.jsonld
@@ -0,0 +1,61 @@
+{
+    "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:token", 
+	"wrap": {
+	    "@type": "korap:term", 
+	    "foundry": "mate",
+	    "layer" : "lemma",
+	    "key":"der", 
+	    "match": "match:eq"
+	}
+    },
+    "meta":{
+	"startPage":1,
+	"count": 10,
+	"context":{
+	    "left":["char",90],
+	    "right":["char",90]
+	}
+    },
+    "collections": [
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00001"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00002"
+		    }
+		]
+	    }
+	},
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00003"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00002"
+		    }
+		]
+	    }
+	}
+    ]
+}
diff --git a/src/test/resources/queries/metaquery8-nocollection.jsonld b/src/test/resources/queries/metaquery8-nocollection.jsonld
new file mode 100644
index 0000000..6edf506
--- /dev/null
+++ b/src/test/resources/queries/metaquery8-nocollection.jsonld
@@ -0,0 +1,21 @@
+{
+    "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:token", 
+	"wrap": {
+	    "@type": "korap:term", 
+	    "foundry": "mate",
+	    "layer" : "lemma",
+	    "key":"der", 
+	    "match": "match:eq"
+	}
+    },
+    "meta":{
+	"startPage":1,
+	"count": 10,
+	"context":{
+	    "left":["char",90],
+	    "right":["char",90]
+	}
+    }
+}
diff --git a/src/test/resources/queries/metaquery8.jsonld b/src/test/resources/queries/metaquery8.jsonld
new file mode 100644
index 0000000..77dfc4c
--- /dev/null
+++ b/src/test/resources/queries/metaquery8.jsonld
@@ -0,0 +1,42 @@
+{
+    "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:token", 
+	"wrap": {
+	    "@type": "korap:term", 
+	    "foundry": "mate",
+	    "layer" : "lemma",
+	    "key":"der", 
+	    "match": "match:eq"
+	}
+    },
+    "meta":{
+	"startPage":1,
+	"count": 10,
+	"context":{
+	    "left":["char",90],
+	    "right":["char",90]
+	}
+    },
+    "collections": [
+	{
+	    "@type": "korap:meta-filter",
+	    "@id": "korap-filter#id-1223232",
+	    "@value": {
+		"@type": "korap:group",
+		"relation": "or",
+		"@field": "korap:field#ID",
+		"operands": [
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00001"
+		    },
+		    {
+			"@type": "korap:term",
+			"@value": "WPD_AAA.00002"
+		    }
+		]
+	    }
+	}
+    ]
+}