Fixed support for new siglen system

Change-Id: I7cbbc93a129e7549403ecd62141c5a6276344cb4
diff --git a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
index 95d63f7..aac0f2f 100644
--- a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
+++ b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
@@ -27,7 +27,8 @@
     private final static Logger qlog = KustvaktLogger.getLogger("queryLogger");
     private final static Logger jlog = LoggerFactory
             .getLogger(SearchKrill.class);
-    // Temporary
+
+    // Temporary - shouldn't be here.
     String indexDir = "/data/prep_corpus/index/";
     String i = "/Users/hanl/Projects/prep_corpus";
     String klinux10 = "/vol/work/hanl/indices";
@@ -56,14 +57,12 @@
         catch (IOException e) {
             jlog.error("Unable to loadSubTypes index: {}", e.getMessage());
         };
-    }
+    };
 
 
     public KrillIndex getIndex () {
         return this.index;
-    }
-
-    ;
+    };
 
 
     /**
@@ -80,9 +79,7 @@
         Result kr = new Result();
         kr.addError(601, "Unable to find index");
         return kr.toJsonString();
-    }
-
-    ;
+    };
 
 
     /**
@@ -100,9 +97,7 @@
         Result kr = new Result();
         kr.addError(601, "Unable to find index");
         return kr.toJsonString();
-    }
-
-    ;
+    };
 
 
     /**
@@ -126,9 +121,7 @@
         Match km = new Match();
         km.addError(601, "Unable to find index");
         return km.toJsonString();
-    }
-
-    ;
+    };
 
 
     public String getMatch (String id, List<String> foundries,
@@ -151,9 +144,7 @@
         Match km = new Match();
         km.addError(601, "Unable to find index");
         return km.toJsonString();
-    }
-
-    ;
+    };
 
 
     /**
@@ -201,9 +192,7 @@
         Match km = new Match();
         km.addError(601, "Unable to find index");
         return km.toJsonString();
-    }
-
-    ;
+    };
 
 
     /**
@@ -239,16 +228,26 @@
                 .append(tokens).append(",\"sentences\":").append(sentences)
                 .append(",\"paragraphs\":").append(paragraphs).append("}");
         return sb.toString();
-    }
+    };
 
-    ;
+    /**
+	 * Return the match identifier as a string.
+	 * This is a convenient method to deal with legacy instantiation of the
+	 * code.
+	 */
+    public String getMatchId (String corpusID, String docID, String matchID) {
+		String docIDtextID [] = docID.split("\\.", 2);
 
+		// Create a string representation of the match 
+		StringBuilder sb = new StringBuilder()
+			.append("match-")
+			.append(corpusID).append('/')
+			.append(docIDtextID[0]);
 
-    public String getMatchId (String type, String docid, String tofrom) {
-        return new StringBuilder().append("match-").append(type).append("!")
-                .append(type).append("_").append(docid).append("-")
-                .append(tofrom).toString();
-    }
+		// The docID was split
+		if (docIDtextID.length == 2)
+			sb.append('/').append(docIDtextID[1]);
 
-    ;
-};
\ No newline at end of file
+		return sb.append('-').append(matchID).toString();
+    };
+};
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index 3ede08c..e28b85b 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -290,10 +290,16 @@
     }
 
 
+	/*
+	 * TODO: The problem here is, that the matchinfo path makes no
+	 * distinction between docs and texts - unlike DeReKo, the backend
+	 * and the frontend. Luckily there is a convenient method
+	 * "getMatchID()" for a workaround, but this should be fixed.
+	 */
     @GET
     @Path("/corpus/{id}/{docid}/{rest}/matchInfo")
     public Response getMatchInfo (@PathParam("id") String id,
-            @PathParam("docid") String docid, @PathParam("rest") String rest,
+								  @PathParam("docid") String docid, @PathParam("rest") String rest,
             @QueryParam("foundry") Set<String> foundries,
             @QueryParam("layer") Set<String> layers,
             @QueryParam("spans") Boolean spans) {
diff --git a/src/main/resources/changelog b/src/main/resources/changelog
index 50f47a7..58275c3 100644
--- a/src/main/resources/changelog
+++ b/src/main/resources/changelog
@@ -1,6 +1,9 @@
 === CHANGELOG FILE ===
 
+13/10/2016
+    - MOD: updated search to use new siglen (diewald)
+
 05/05/2015
-    - ADD: rest test suite for user service
-    - MOD: setup parameter modification
-    - ADD: oauth2 client unique constraint
+    - ADD: rest test suite for user service (hanl)
+    - MOD: setup parameter modification (hanl)
+    - ADD: oauth2 client unique constraint (hanl)