Try to fix classspans

Change-Id: I4b61820d2942c375c48b4f6a27e64f61aa57d9b0
diff --git a/pom.xml b/pom.xml
index 4c9819b..4a1e534 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
 
       ** Indexer after packaging (see above)
       $ java -jar target/Krill-Indexer.jar
-             src/main/resources/krill.properties
+             -cfg src/main/resources/krill.properties
              /data/hdd/lucene-new/WPD/
   -->
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
index 57d3d81..0b189d0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
@@ -55,8 +55,9 @@
 
     private boolean isClassOperationValid () throws IOException {
         setBitsets();
-        int cardinality = Math
-                .max(bitset1.cardinality(), bitset2.cardinality());
+
+        int cardinality = Math.max(bitset1.cardinality(), bitset2.cardinality());
+
         bitset1.and(bitset2);
         // System.out.println("cardinality:" + cardinality);
         switch (operation) {
@@ -92,10 +93,20 @@
         int start, end;
         // System.out.println("------------------------");
         for (byte[] payload : firstSpans.getPayload()) {
-            if (payload.length == 9) {
-                start = byte2int(payload, 0) + 1;
-                end = byte2int(payload, 4) + 1;
-                if (payload[8] == classNum1) {
+            System.err.println(
+                               "** " +
+                               payload[0] +
+                               "|" +
+                               byte2int(payload, 1) +
+                               "|" +
+                               byte2int(payload, 5) +
+                               "|" +
+                               payload[8] +
+                               " **");
+            if (payload[0] == 0) {
+                start = byte2int(payload, 1) + 1;
+                end = byte2int(payload, 5) + 1;
+                if (payload[9] == classNum1) {
                     // System.out.println("bitset1 " + start + " " +
                     // end);
                     if (bitset1 == null) {
@@ -108,7 +119,7 @@
                     }
                     // System.out.println(bitset1);
                 }
-                else if (payload[8] == classNum2) {
+                else if (payload[9] == classNum2) {
                     // System.out.println("#bitset2 " + start + " " +
                     // end);
                     if (bitset2 == null) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
index f168295..bb49e6a 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
@@ -148,6 +148,14 @@
         // Todo: Better allocate using a Factory!
         bb.clear();
         bb.put((byte) 0).putInt(spans.start()).putInt(spans.end()).put(number);
+        System.err.println(
+                           "####################### " + 
+                           spans.start() +
+                           "|" + 
+                           spans.end() +
+                           ":" +
+                           number
+                           );
 
         // Add highlight information as byte array
         classedPayload.add(bb.array());
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
index 1380c91..4a697f4 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
@@ -148,8 +148,9 @@
 
 			// FIX ME
 			// Copy the start and end character offsets
-            b = Arrays.copyOfRange(bb.array(), 1, 9);
-            this.matchPayload = Collections.singletonList(b);
+            // b = Arrays.copyOfRange(bb.array(), 1, 9);
+            // this.matchPayload = Collections.singletonList(b);
+            this.matchPayload = Collections.singletonList(bb.array());
             return;
         }