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 2e88db8..8edb8be 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
@@ -55,13 +55,13 @@
     }
 
 
-    public DistanceConstraint createConstraint (String unit, int min, int max,
+    public static DistanceConstraint createConstraint (String unit, int min, int max,
             boolean isOrdered, boolean exclusion) {
         return createConstraint("base", unit, min, max, isOrdered, exclusion);
     }
 
 
-    public DistanceConstraint createConstraint (String field, String unit,
+    public static DistanceConstraint createConstraint (String field, String unit,
             int min, int max, boolean isOrdered, boolean exclusion) {
 
         if (unit.equals("w")) {
@@ -279,133 +279,6 @@
 	
 
     @Test
-	@Ignore("Private data usage")
-    public void testWithSampleIndex () throws IOException, QueryException {
-        KrillIndex sample = getSampleIndex();
-
-        WildcardQuery wcquery =
-                new WildcardQuery(new Term("tokens", "s:meine*"));
-        SpanMultiTermQueryWrapper<WildcardQuery> mtq =
-                new SpanMultiTermQueryWrapper<WildcardQuery>(wcquery);
-
-        SpanTermQuery sq =
-                new SpanTermQuery(new Term("tokens", "tt/l:Erfahrung"));
-
-        // meine* /+w1:2 &Erfahrung
-        SpanQuery tdq = new SpanDistanceQuery(mtq, sq,
-                createConstraint("w", 1, 2, true, false), true);
-
-        kr = sample.search(tdq, (short) 10);
-        assertEquals(4, kr.getMatches().size());
-        assertEquals(107, kr.getMatch(0).getStartPos());
-        assertEquals(109, kr.getMatch(0).getEndPos());
-        assertEquals(132566, kr.getMatch(1).getStartPos());
-        assertEquals(132569, kr.getMatch(1).getEndPos());
-        assertEquals(161393, kr.getMatch(2).getStartPos());
-        assertEquals(161396, kr.getMatch(2).getEndPos());
-        assertEquals(10298, kr.getMatch(3).getStartPos());
-        assertEquals(10301, kr.getMatch(3).getEndPos());
-
-        // meine* /+s0 &Erfahrung
-        SpanQuery edq = new SpanDistanceQuery(mtq, sq,
-                createConstraint("tokens", "base/s:s", 0, 0, true, false),
-                true);
-        kr = sample.search(edq, (short) 20);
-        assertEquals(18, kr.getMatches().size());
-
-        //meine* /+w1:2,s0 &Erfahrung
-        List<DistanceConstraint> constraints =
-                new ArrayList<DistanceConstraint>();
-        constraints.add(createConstraint("w", 1, 2, true, false));
-        constraints
-                .add(createConstraint("tokens", "base/s:s", 0, 0, true, false));
-
-        SpanQuery mdsq = new SpanMultipleDistanceQuery(
-                new SpanClassQuery(mtq, (byte) 129),
-                new SpanClassQuery(sq, (byte) 129), constraints, true, true);
-        kr = sample.search(mdsq, (short) 10);
-        assertEquals(4, kr.getMatches().size());
-
-        // check SpanQueryWrapper generated query
-        SpanQueryWrapper sqwi = getJSONQuery(
-                getClass().getResource("/queries/bugs/cosmas_wildcards.jsonld")
-                        .getFile());
-        SpanQuery jsq = sqwi.toQuery();
-        assertEquals(mdsq.toString(), jsq.toString());
-    }
-
-
-    @Test
-	@Ignore("Private data usage")
-    public void testWithSampleIndexAndJson ()
-            throws IOException, QueryException {
-        KrillIndex sample = getSampleIndex();
-        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_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());
-
-        krill.setSpanQuery(qw.toQuery());
-        kr = krill.apply(sample);
-        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("Private data usage")
-    public void testWithKrillWithCollection () throws IOException {
-        KrillIndex sample = getSampleIndex();
-
-        // 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);
-		assertEquals(krill.getCollection().toString(),
-					 "QueryWrapperFilter(availability:/QAO.*/)");
-        kr = krill.apply(sample);
-        assertEquals(4, kr.getMatches().size());
-    }
-
-
-    @Test
     public void testUnorderedTokenDistance () throws IOException {
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc4());
@@ -733,13 +606,4 @@
         assertEquals(7, kr.getMatch(0).getEndPos());
 
     }
-
-	private KrillIndex getSampleIndex () throws IOException {
-		return new KrillIndex(
-			new MMapDirectory(
-				Paths.get(getClass().getResource("/sample-index").getFile()
-					)
-				)
-			);
-	};
 }
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
new file mode 100644
index 0000000..5c60938
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
@@ -0,0 +1,298 @@
+package de.ids_mannheim.korap.index;
+
+import static de.ids_mannheim.korap.TestSimple.getJSONQuery;
+import static de.ids_mannheim.korap.TestSimple.getJsonString;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.WildcardQuery;
+import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.store.MMapDirectory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import de.ids_mannheim.korap.Krill;
+import de.ids_mannheim.korap.KrillCollection;
+import de.ids_mannheim.korap.KrillIndex;
+import de.ids_mannheim.korap.KrillQuery;
+import de.ids_mannheim.korap.query.DistanceConstraint;
+import de.ids_mannheim.korap.query.SpanClassQuery;
+import de.ids_mannheim.korap.query.SpanDistanceQuery;
+import de.ids_mannheim.korap.query.SpanMultipleDistanceQuery;
+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;
+
+import de.ids_mannheim.korap.index.TestMultipleDistanceIndex;
+
+public class TestSampleIndex {
+
+    private Result kr;
+    private KrillIndex sample;
+    private Krill krillAvailabilityAll;
+
+
+    private KrillIndex getSampleIndex () throws IOException {
+        return new KrillIndex(new MMapDirectory(
+                Paths.get(getClass().getResource("/sample-index").getFile())));
+
+    };
+
+
+    public TestSampleIndex () throws IOException {
+        sample = getSampleIndex();
+        String jsonCollection = getJsonString(getClass()
+                .getResource("/collection/availability-all.jsonld").getFile());
+        KrillCollection collection = new KrillCollection(jsonCollection);
+        krillAvailabilityAll = new Krill();
+        krillAvailabilityAll.setCollection(collection);
+    }
+
+
+    @Test
+    public void testMultipleDistanceWithWildcards ()
+            throws IOException, QueryException {
+        WildcardQuery wcquery =
+                new WildcardQuery(new Term("tokens", "s:meine*"));
+        SpanMultiTermQueryWrapper<WildcardQuery> mtq =
+                new SpanMultiTermQueryWrapper<WildcardQuery>(wcquery);
+
+        SpanTermQuery sq =
+                new SpanTermQuery(new Term("tokens", "tt/l:Erfahrung"));
+
+        // meine* /+w1:2 &Erfahrung
+        SpanQuery tdq = new SpanDistanceQuery(mtq, sq, TestMultipleDistanceIndex
+                .createConstraint("w", 1, 2, true, false), true);
+
+        kr = sample.search(tdq, (short) 10);
+        assertEquals(4, kr.getMatches().size());
+        assertEquals(107, kr.getMatch(0).getStartPos());
+        assertEquals(109, kr.getMatch(0).getEndPos());
+        assertEquals(132566, kr.getMatch(1).getStartPos());
+        assertEquals(132569, kr.getMatch(1).getEndPos());
+        assertEquals(161393, kr.getMatch(2).getStartPos());
+        assertEquals(161396, kr.getMatch(2).getEndPos());
+        assertEquals(10298, kr.getMatch(3).getStartPos());
+        assertEquals(10301, kr.getMatch(3).getEndPos());
+
+        // meine* /+s0 &Erfahrung
+        SpanQuery edq = new SpanDistanceQuery(mtq, sq, TestMultipleDistanceIndex
+                .createConstraint("tokens", "base/s:s", 0, 0, true, false),
+                true);
+        kr = sample.search(edq, (short) 20);
+        assertEquals(18, kr.getMatches().size());
+
+        //meine* /+w1:2,s0 &Erfahrung
+        List<DistanceConstraint> constraints =
+                new ArrayList<DistanceConstraint>();
+        constraints.add(TestMultipleDistanceIndex.createConstraint("w", 1, 2,
+                true, false));
+        constraints.add(TestMultipleDistanceIndex.createConstraint("tokens",
+                "base/s:s", 0, 0, true, false));
+
+        SpanQuery mdsq = new SpanMultipleDistanceQuery(
+                new SpanClassQuery(mtq, (byte) 129),
+                new SpanClassQuery(sq, (byte) 129), constraints, true, true);
+        kr = sample.search(mdsq, (short) 10);
+        assertEquals(4, kr.getMatches().size());
+
+        // check SpanQueryWrapper generated query
+        SpanQueryWrapper sqwi = getJSONQuery(
+                getClass().getResource("/queries/bugs/cosmas_wildcards.jsonld")
+                        .getFile());
+        SpanQuery jsq = sqwi.toQuery();
+        assertEquals(mdsq.toString(), jsq.toString());
+    }
+
+
+    @Test
+    public void testWildcardsWithJson () throws IOException, QueryException {
+        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_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());
+
+        krill.setSpanQuery(qw.toQuery());
+        kr = krill.apply(sample);
+        assertEquals(4, kr.getMatches().size());
+    }
+
+
+    @Test
+    public void testWildcardsWithCollectionJSON () throws IOException {
+        // 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);
+        assertEquals(krill.getCollection().toString(),
+                "QueryWrapperFilter(availability:/QAO.*/)");
+        kr = krill.apply(sample);
+        assertEquals(4, kr.getMatches().size());
+
+    }
+
+
+    @Test
+    public void testWildcardStarWithCollection () throws IOException {
+        // &Erfahrung
+        SpanTermQuery sq =
+                new SpanTermQuery(new Term("tokens", "tt/l:Erfahrung"));
+
+        // meine*
+        WildcardQuery wcquery =
+                new WildcardQuery(new Term("tokens", "s:meine*"));
+        SpanMultiTermQueryWrapper<WildcardQuery> mtq =
+                new SpanMultiTermQueryWrapper<WildcardQuery>(wcquery);
+
+        // /+w1:2,s0
+        List<DistanceConstraint> constraints =
+                new ArrayList<DistanceConstraint>();
+        constraints.add(TestMultipleDistanceIndex.createConstraint("w", 1, 2,
+                true, false));
+        constraints.add(TestMultipleDistanceIndex.createConstraint("tokens",
+                "base/s:s", 0, 0, true, false));
+
+        // meine* /+w1:2,s0 &Erfahrung
+        SpanQuery mdsq = new SpanMultipleDistanceQuery(
+                new SpanClassQuery(mtq, (byte) 129),
+                new SpanClassQuery(sq, (byte) 129), constraints, true, true);
+
+        krillAvailabilityAll.setSpanQuery(mdsq);
+        kr = sample.search(krillAvailabilityAll);
+
+        assertEquals(4, kr.getMatches().size());
+
+        assertEquals("match-GOE/AGI/04846-p107-109", kr.getMatch(0).getID());
+        assertEquals("QAO-NC-LOC:ids", kr.getMatch(0).getAvailability());
+        assertEquals("... gelesen und erzählt hat, ich in "
+                + "[[meine Erfahrungen]] hätte mit aufnehmen sollen. "
+                + "heute jedoch ...",
+                kr.getMatch(0).getSnippetBrackets());
+
+        assertEquals("match-GOE/AGD/00000-p132566-132569",
+                kr.getMatch(1).getID());
+        assertEquals("QAO-NC-LOC:ids-NU:1", kr.getMatch(1).getAvailability());
+        assertEquals("... Mannes umständlich beibringen und solches "
+                + "durch [[meine eigne Erfahrung]] bekräftigen: das "
+                + "alles sollte nicht gelten ...",
+                kr.getMatch(1).getSnippetBrackets());
+
+        assertEquals("match-GOE/AGD/00000-p161393-161396",
+                kr.getMatch(2).getID());
+        assertEquals("QAO-NC-LOC:ids-NU:1", kr.getMatch(2).getAvailability());
+        assertEquals("... lassen, bis er sich zuletzt an "
+                + "[[meine sämtlichen Erfahrungen]] und Überzeugungen "
+                + "anschloß, in welchem Sinne ...",
+                kr.getMatch(2).getSnippetBrackets());
+
+        assertEquals("match-GOE/AGD/06345-p10298-10301",
+                kr.getMatch(3).getID());
+        assertEquals("QAO-NC", kr.getMatch(3).getAvailability());
+        assertEquals("... bis aufs Äußerste verfolgte, und, über "
+                + "[[meine enge Erfahrung]] hinaus, nach ähnlichen Fällen "
+                + "in der ...", kr.getMatch(3).getSnippetBrackets());
+
+    }
+
+
+    @Test
+    public void testWildcardQuestionMarkWithCollection () throws IOException {
+        // &Erfahrung
+        SpanTermQuery sq =
+                new SpanTermQuery(new Term("tokens", "tt/l:Erfahrung"));
+
+        // /+w1:2,s0
+        List<DistanceConstraint> constraints =
+                new ArrayList<DistanceConstraint>();
+        constraints.add(TestMultipleDistanceIndex.createConstraint("w", 1, 2,
+                true, false));
+        constraints.add(TestMultipleDistanceIndex.createConstraint("tokens",
+                "base/s:s", 0, 0, true, false));
+
+        // meine? /+w1:2,s0 &Erfahrung
+        SpanMultiTermQueryWrapper<WildcardQuery> mtq =
+                new SpanMultiTermQueryWrapper<WildcardQuery>(
+                        new WildcardQuery(new Term("tokens", "s:meine?")));
+        SpanMultipleDistanceQuery mdsq = new SpanMultipleDistanceQuery(
+                new SpanClassQuery(mtq, (byte) 129),
+                new SpanClassQuery(sq, (byte) 129), constraints, true, true);
+
+        krillAvailabilityAll.setSpanQuery(mdsq);
+        kr = sample.search(krillAvailabilityAll);
+        assertEquals(4, kr.getMatches().size());
+        
+        //spans(spanOr([tokens:s:meinem, tokens:s:meinen, tokens:s:meiner, tokens:s:meines]))@0:36-37
+    }
+
+
+    @Test
+    public void testWildcardPlusWithCollection () throws IOException {
+     // &Erfahrung
+        SpanTermQuery sq =
+                new SpanTermQuery(new Term("tokens", "tt/l:Erfahrung"));
+
+        // /+w1:2,s0
+        List<DistanceConstraint> constraints =
+                new ArrayList<DistanceConstraint>();
+        constraints.add(TestMultipleDistanceIndex.createConstraint("w", 1, 2,
+                true, false));
+        constraints.add(TestMultipleDistanceIndex.createConstraint("tokens",
+                "base/s:s", 0, 0, true, false));
+        
+        // mein+ /+w1:2,s0 &Erfahrung
+        SpanMultiTermQueryWrapper<WildcardQuery> mtq = new SpanMultiTermQueryWrapper<WildcardQuery>(
+                new WildcardQuery(new Term("tokens", "s:mein+")));
+        SpanMultipleDistanceQuery mdsq = new SpanMultipleDistanceQuery(
+                new SpanClassQuery(mtq, (byte) 129),
+                new SpanClassQuery(sq, (byte) 129), constraints, true, true);
+
+        krillAvailabilityAll.setSpanQuery(mdsq);
+        kr = sample.search(krillAvailabilityAll);
+        assertEquals(4, kr.getMatches().size());
+        
+        //spanOr([])
+    }
+}
diff --git a/src/test/resources/collection/availability-all.jsonld b/src/test/resources/collection/availability-all.jsonld
new file mode 100644
index 0000000..bb8466f
--- /dev/null
+++ b/src/test/resources/collection/availability-all.jsonld
@@ -0,0 +1,39 @@
+{"collection": {
+    "operation": "operation:or",
+    "operands": [
+        {
+            "@type": "koral:doc",
+            "value": "CC-BY.*",
+            "match": "match:eq",
+            "type": "type:regex",
+            "key": "availability"
+        },
+        {
+            "operation": "operation:or",
+            "operands": [
+                {
+                    "@type": "koral:doc",
+                    "value": "ACA.*",
+                    "match": "match:eq",
+                    "type": "type:regex",
+                    "key": "availability"
+                },
+                {
+                    "@type": "koral:doc",
+                    "value": "QAO.*",
+                    "match": "match:eq",
+                    "type": "type:regex",
+                    "key": "availability"
+                }
+            ],
+            "@type": "koral:docGroup"
+        }
+    ],
+    "@type": "koral:docGroup",
+    "rewrites": [{
+        "@type": "koral:rewrite",
+        "src": "Kustvakt",
+        "operation": "operation:insertion",
+        "scope": "availability(ALL)"
+    }]
+}}
