Bughunting in highlighting
diff --git a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
index d177eb3..c1b2d1c 100644
--- a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
+++ b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
@@ -23,7 +23,7 @@
 import org.junit.runners.JUnit4;
 
 @RunWith(JUnit4.class)
-public class TestBenchmarkElementSpans {
+public class TestBenchmarkSpans {
 
     @Test
     public void checkBenchmark1 () throws IOException {
@@ -152,6 +152,80 @@
 
     
     @Test
+    public void checkBenchmarkClasses () throws IOException {
+	// [orth=Der]{1:[orth=Mann]{2:[orth=und]}}
+
+	Properties prop = new Properties();
+	InputStream fr = new FileInputStream(getClass().getResource("/korap.conf").getFile());
+	prop.load(fr);
+
+	// Get the real index
+	KorapIndex ki = new KorapIndex(new MMapDirectory(new File(prop.getProperty("lucene.indexDir"))));
+
+	// Create a container for virtual collections:
+	KorapCollection kc = new KorapCollection(ki);
+
+	long t1 = 0, t2 = 0;
+	// Without classes
+	String json = getString(getClass().getResource("/queries/benchmark5-ohne.jsonld").getFile());
+
+	int rounds = 2000;
+
+	KorapResult kr = new KorapResult();
+
+	t1 = System.nanoTime();
+	for (int i = 1; i <= rounds; i++) {
+	    kr = new KorapSearch(json).run(ki);
+	};
+	t2 = System.nanoTime();
+
+	double seconds = (double)(t2-t1) / 1000000000.0;
+	
+	System.out.println("It took " + seconds + " seconds without classes");
+
+	t1 = 0;
+	t2 = 0;
+	// With classes
+	json = getString(getClass().getResource("/queries/benchmark5.jsonld").getFile());
+
+	t1 = System.nanoTime();
+	for (int i = 1; i <= rounds; i++) {
+	    kr = new KorapSearch(json).run(ki);
+	};
+	t2 = System.nanoTime();
+
+	seconds = (double)(t2-t1) / 1000000000.0;
+	
+	System.out.println("It took " + seconds + " seconds with classes");
+
+
+	// System.err.println(kr.toJSON());
+
+	System.err.println(kr.getMatch(3).getSnippetBrackets());
+
+
+	// 2000 rounds:
+	// It took 10.872934435 seconds without classes
+	// It took 22.581117396 seconds with classes
+
+	// It took 10.703933598 seconds without classes
+	// It took 19.354674517 seconds with classes
+
+	// It took 10.939948726 seconds without classes
+	// It took 16.998470662 seconds with classes
+
+	// It took 10.900975837 seconds without classes
+	// It took 14.902590949 seconds with classes
+
+	// It took 10.365989238 seconds without classes
+	// It took 13.833405885 seconds with classes
+
+    };
+
+
+
+    
+    @Test
     public void checkBenchmarkIndexDocuments () throws IOException {
 	long t1 = 0, t2 = 0;
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 0127a65..bb2ff5f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -187,6 +187,11 @@
 	System.err.println(kr.toJSON());
 	*/
 
+
+	kr = ki.search(query, 0, (short) 1, true, (short) 2, false, (short) 5);
+	assertEquals("... Buchstabe des [{1:{2:lateinischen} Alphabets}] und  ...", kr.match(0).getSnippetBrackets());
+
+	
 	kr = ki.search(query, 0, (short) 50, true, (short) 2, false, (short) 5);
 
 //	System.err.println(kr.toJSON());
diff --git a/src/test/resources/queries/benchmark5-ohne.jsonld b/src/test/resources/queries/benchmark5-ohne.jsonld
new file mode 100644
index 0000000..725be7a
--- /dev/null
+++ b/src/test/resources/queries/benchmark5-ohne.jsonld
@@ -0,0 +1,33 @@
+{
+    "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:group", 
+	"operation": "operation:sequence",
+	"operands": [
+	    {
+		"@type": "korap:token",
+		"wrap" : {
+		    "@type": "korap:term", 
+		    "layer": "orth",
+		    "key" : "der"
+		}
+	    },
+	    {
+		"@type": "korap:token",
+		"wrap" : {
+		    "@type": "korap:term", 
+		    "layer": "orth",
+		    "key" : "Mann"
+		}
+	    },
+	    {
+		"@type": "korap:token",
+		"wrap" : {
+		    "@type": "korap:term", 
+		    "layer": "orth",
+		    "key" : "und"
+		}
+	    }
+	]
+    }
+}
diff --git a/src/test/resources/queries/benchmark5.jsonld b/src/test/resources/queries/benchmark5.jsonld
new file mode 100644
index 0000000..332d23f
--- /dev/null
+++ b/src/test/resources/queries/benchmark5.jsonld
@@ -0,0 +1,54 @@
+{
+    "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+    "query": {
+	"@type": "korap:group", 
+	"operation": "operation:sequence",
+	"operands": [
+	    {
+		"@type": "korap:token",
+		"wrap" : {
+		    "@type": "korap:term", 
+		    "layer": "orth",
+		    "key" : "der"
+		}
+	    },
+	    {
+		"@type" : "korap:group",
+		"operation" : "operation:class",
+		"class" : 1,
+		"operands" : [
+		    {
+			"@type": "korap:group", 
+			"operation": "operation:sequence",
+			"operands" : [
+			    {
+				"@type": "korap:token",
+				"wrap" : {
+				    "@type": "korap:term", 
+				    "layer": "orth",
+				    "key" : "Mann"
+				}
+			    },
+			    {
+				"@type" : "korap:group",
+				"operation" : "operation:class",
+				"class" : 2,
+				"operands" : [
+				    {
+					"@type": "korap:token",
+					"wrap" : {
+					    "@type": "korap:term", 
+					    "layer": "orth",
+					    "key" : "und"
+					}
+				    }
+				]
+			    }
+			    
+			]
+		    }
+		]
+	    }
+	]
+    }
+}