Some tests were missing
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java
new file mode 100644
index 0000000..f61254b
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchCollector.java
@@ -0,0 +1,88 @@
+package de.ids_mannheim.korap.index;
+
+import java.util.*;
+import java.io.*;
+
+import org.apache.lucene.util.Version;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.Bits;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import de.ids_mannheim.korap.KorapIndex;
+import de.ids_mannheim.korap.KorapQuery;
+import de.ids_mannheim.korap.KorapMatch;
+import de.ids_mannheim.korap.index.MatchCollector;
+import de.ids_mannheim.korap.KorapCollection;
+import de.ids_mannheim.korap.KorapSearch;
+import de.ids_mannheim.korap.query.SpanNextQuery;
+import de.ids_mannheim.korap.query.SpanMatchModifyClassQuery;
+import de.ids_mannheim.korap.query.SpanClassQuery;
+import de.ids_mannheim.korap.index.FieldDocument;
+import de.ids_mannheim.korap.analysis.MultiTermTokenStream;
+
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.search.spans.SpanOrQuery;
+import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.index.Term;
+
+// mvn -Dtest=TestWithinIndex#indexExample1 test
+
+// match is shrink and split
+
+@RunWith(JUnit4.class)
+public class TestMatchCollector {
+
+ @Test
+ public void indexExample1 () throws IOException {
+ KorapIndex ki = new KorapIndex();
+
+ // abcabcabac
+ FieldDocument fd = new FieldDocument();
+ fd.addString("ID", "doc-1");
+ fd.addString("UID", "1");
+ fd.addTV("base",
+ "abcabcabac",
+ "[(0-1)s:a|i:a|_0#0-1|-:t$<i>10]" +
+ "[(1-2)s:b|i:b|_1#1-2]" +
+ "[(2-3)s:c|i:c|_2#2-3]" +
+ "[(3-4)s:a|i:a|_3#3-4]" +
+ "[(4-5)s:b|i:b|_4#4-5]" +
+ "[(5-6)s:c|i:c|_5#5-6]" +
+ "[(6-7)s:a|i:a|_6#6-7]" +
+ "[(7-8)s:b|i:b|_7#7-8]" +
+ "[(8-9)s:a|i:a|_8#8-9]" +
+ "[(9-10)s:c|i:c|_9#9-10]");
+ ki.addDoc(fd);
+
+ fd = new FieldDocument();
+ fd.addString("ID", "doc-2");
+ fd.addString("UID", "2");
+ fd.addTV("base",
+ "bcbabd",
+ "[(0-1)s:b|i:b|_1#0-1]" +
+ "[(1-2)s:c|i:c|s:b|_2#1-2]" +
+ "[(2-3)s:b|i:b|_3#2-3|<>:e#2-4$<i>4]" +
+ "[(3-4)s:a|i:a|_4#3-4|<>:e#3-5$<i>5|<>:e2#3-5$<i>5]" +
+ "[(4-5)s:b|i:b|s:c|_5#4-5]" +
+ "[(5-6)s:d|i:d|_6#5-6|<>:e2#5-6$<i>6]");
+ ki.addDoc(fd);
+
+ ki.commit();
+
+ SpanQuery sq;
+
+ sq = new SpanTermQuery(new Term("base", "s:b"));
+ MatchCollector mc = ki.collect(
+ new KorapSearch(sq).setCount((short) 10),
+ new MatchCollector()
+ );
+
+ assertEquals(mc.getTotalResults(), 5);
+ assertEquals(mc.getTotalResultDocs(), 2);
+ };
+};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
new file mode 100644
index 0000000..1062d4a
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
@@ -0,0 +1,45 @@
+package de.ids_mannheim.korap.index;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.store.MMapDirectory;
+import org.junit.Test;
+
+import de.ids_mannheim.korap.*;
+import de.ids_mannheim.korap.util.QueryException;
+
+public class TestRealIndex {
+ KorapIndex ki;
+ KorapResult kr;
+ KorapSearch ks;
+ KorapQuery kq;
+
+ public TestRealIndex() throws IOException {
+ InputStream is = getClass().getResourceAsStream("/server.properties");
+ Properties prop = new Properties();
+ prop.load(is);
+
+ String indexPath = prop.getProperty("lucene.indexDir");
+ System.err.println(indexPath);
+ MMapDirectory md = new MMapDirectory(new File(indexPath));
+ ki = new KorapIndex(md);
+ };
+
+ @Test
+ public void testCase1() throws IOException, QueryException {
+ KorapQuery kq = new KorapQuery("tokens");
+ ks = new KorapSearch(kq.within(kq.tag("base/s:s"), kq.seq(kq.re("s:.*")).append(kq._(kq.re("s:.*")))).toQuery());
+ ks.setTimeOut(10000);
+ kr = ks.run(ki);
+ System.err.println(kr.toJSON());
+ assertEquals(8, kr.getTotalResults());
+ };
+}
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java b/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
new file mode 100644
index 0000000..f8a2963
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
@@ -0,0 +1,67 @@
+package de.ids_mannheim.korap.highlight;
+
+import java.util.*;
+import java.io.IOException;
+
+import org.apache.lucene.search.spans.SpanQuery;
+
+import de.ids_mannheim.korap.KorapIndex;
+import de.ids_mannheim.korap.KorapQuery;
+import de.ids_mannheim.korap.KorapResult;
+import de.ids_mannheim.korap.KorapSearch;
+import de.ids_mannheim.korap.KorapMatch;
+import de.ids_mannheim.korap.index.FieldDocument;
+
+import de.ids_mannheim.korap.util.QueryException;
+
+import static de.ids_mannheim.korap.TestSimple.*;
+//import static de.ids_mannheim.korap.Test.*;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class TestTemporaryQueryLimitations {
+
+ @Test
+ public void classRefCheckNotSupported () throws IOException, QueryException {
+
+ // Construct index
+ KorapIndex ki = new KorapIndex();
+ String json = new String(
+"{" +
+" \"fields\" : [" +
+" { "+
+" \"primaryData\" : \"abc\"" +
+" }," +
+" {" +
+" \"name\" : \"tokens\"," +
+" \"data\" : [" +
+" [ \"s:a\", \"i:a\", \"_0#0-1\", \"-:t$<i>3\"]," +
+" [ \"s:b\", \"i:b\", \"_1#1-2\" ]," +
+" [ \"s:c\", \"i:c\", \"_2#2-3\" ]" +
+" ]" +
+" }" +
+" ]" +
+"}");
+
+ FieldDocument fd = ki.addDoc(json);
+ ki.commit();
+
+ json = getString(getClass().getResource("/queries/bugs/cosmas_classrefcheck.jsonld").getFile());
+
+ KorapSearch ks = new KorapSearch(json);
+ KorapResult kr = ks.run(ki);
+ assertEquals(kr.getQuery(),"shrink(130: {131: spanContain({129: <tokens:s />}, {130: tokens:s:wegen})})");
+ assertEquals(kr.totalResults(),0);
+ assertEquals(kr.getStartIndex(),0);
+ assertEquals(
+ kr.getWarning(),
+ "classRefCheck is not yet supported - results may not be correct; " +
+ "This is a warning coming from the serialization");
+
+ };
+};