Added tests with collections. 

Change-Id: I207313fff6c9c18cef37b348255ad8e110fafb68
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
index 85adfb7..22c1b1c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
@@ -34,6 +34,7 @@
 import de.ids_mannheim.korap.query.SpanMultipleDistanceQuery;
 import de.ids_mannheim.korap.query.SpanNextQuery;
 import de.ids_mannheim.korap.query.wrap.SpanQueryWrapper;
+import de.ids_mannheim.korap.response.Match;
 import de.ids_mannheim.korap.response.Result;
 import de.ids_mannheim.korap.util.QueryException;
 
@@ -323,49 +324,68 @@
         String path =
                 "/home/elma/git/Kustvakt-new/src/test/resources/sample-index";
         KrillIndex sample = new KrillIndex(new MMapDirectory(Paths.get(path)));
-        SpanQueryWrapper sqwi = getJSONQuery(
-                getClass().getResource("/queries/bugs/cosmas_wildcards2.jsonld")
-                        .getFile());
+        SpanQueryWrapper sqwi = getJSONQuery(getClass()
+                .getResource("/queries/bugs/cosmas_wildcards_all.jsonld")
+                .getFile());
         SpanQuery sq = sqwi.toQuery();
         kr = sample.search(sq, (short) 10);
         assertEquals(4, kr.getMatches().size());
-        
+
         // test krill apply
         Krill krill = new Krill();
         krill.setSpanQuery(sq);
         krill.setIndex(sample);
         kr = krill.apply();
         assertEquals(4, kr.getMatches().size());
-        
+
         // test krill deserialization
-        String jsonString = getJsonString( getClass().getResource("/queries/bugs/cosmas_wildcards2.jsonld")
+        String jsonString = getJsonString(getClass()
+                .getResource("/queries/bugs/cosmas_wildcards_all.jsonld")
                 .getFile());
         krill = new Krill();
-        
+
         ObjectMapper mapper = new ObjectMapper();
         JsonNode jsonNode = mapper.readTree(jsonString);
         final KrillQuery kq = new KrillQuery("tokens");
         krill.setQuery(kq);
-        
+
         SpanQueryWrapper qw = kq.fromKoral(jsonNode.get("query"));
-        assertEquals(sqwi.toQuery(),qw.toQuery());
+        assertEquals(sqwi.toQuery(), qw.toQuery());
 
         krill.setSpanQuery(qw.toQuery());
         kr = krill.apply(sample);
-        assertEquals(4, kr.getMatches().size());   
+        assertEquals(4, kr.getMatches().size());
+
+        //        for(Match m: kr.getMatches()){
+        //            System.out.println(m.getID());
+        //            System.out.println(m.getAvailability());
+        //            System.out.println(m.getSnippetBrackets());
+        //        }
     }
-    
+
+
     @Test
     @Ignore
     public void testWithKrillWithCollection () throws IOException {
         String path =
                 "/home/elma/git/Kustvakt-new/src/test/resources/sample-index";
         KrillIndex sample = new KrillIndex(new MMapDirectory(Paths.get(path)));
-        String json = getJsonString( getClass().getResource("/queries/bugs/cosmas_wildcards2.jsonld")
+
+        // collection .*
+        String json = getJsonString(getClass()
+                .getResource("/queries/bugs/cosmas_wildcards_all.jsonld")
                 .getFile());
         Krill krill = new Krill(json);
         kr = krill.apply(sample);
         assertEquals(4, kr.getMatches().size());
+
+        // collection QAO.*
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/cosmas_wildcards_qao.jsonld")
+                .getFile());
+        krill = new Krill(json);
+        kr = krill.apply(sample);
+        assertEquals(4, kr.getMatches().size());
     }
 
 
@@ -512,14 +532,14 @@
         assertEquals(4, kr.getMatch(4).getStartPos());
         assertEquals(7, kr.getMatch(4).getEndPos());
 
-        //	    System.out.print(kr.getTotalResults()+"\n");
-        //		for (int i=0; i< kr.getTotalResults(); i++){
-        //			System.out.println(
-        //				kr.match(i).getLocalDocID()+" "+
-        //				kr.match(i).startPos + " " +
-        //				kr.match(i).endPos
-        //		    );
-        //		}
+        //      System.out.print(kr.getTotalResults()+"\n");
+        //      for (int i=0; i< kr.getTotalResults(); i++){
+        //          System.out.println(
+        //              kr.match(i).getLocalDocID()+" "+
+        //              kr.match(i).startPos + " " +
+        //              kr.match(i).endPos
+        //          );
+        //      }
 
     }
 
diff --git a/src/test/resources/queries/bugs/cosmas_wildcards2.jsonld b/src/test/resources/queries/bugs/cosmas_wildcards_all.jsonld
similarity index 98%
rename from src/test/resources/queries/bugs/cosmas_wildcards2.jsonld
rename to src/test/resources/queries/bugs/cosmas_wildcards_all.jsonld
index d83488e..1e551b0 100644
--- a/src/test/resources/queries/bugs/cosmas_wildcards2.jsonld
+++ b/src/test/resources/queries/bugs/cosmas_wildcards_all.jsonld
@@ -101,7 +101,7 @@
     },
     "collection": {
         "@type": "koral:doc",
-        "value": "CC-BY.*",
+        "value": ".*",
         "match": "match:eq",
         "type": "type:regex",
         "key": "availability",
diff --git a/src/test/resources/queries/bugs/cosmas_wildcards2.jsonld b/src/test/resources/queries/bugs/cosmas_wildcards_qao.jsonld
similarity index 98%
copy from src/test/resources/queries/bugs/cosmas_wildcards2.jsonld
copy to src/test/resources/queries/bugs/cosmas_wildcards_qao.jsonld
index d83488e..49adf3c 100644
--- a/src/test/resources/queries/bugs/cosmas_wildcards2.jsonld
+++ b/src/test/resources/queries/bugs/cosmas_wildcards_qao.jsonld
@@ -101,7 +101,7 @@
     },
     "collection": {
         "@type": "koral:doc",
-        "value": "CC-BY.*",
+        "value": "QAO.*",
         "match": "match:eq",
         "type": "type:regex",
         "key": "availability",