Introduced default foundry for distance structures
Change-Id: I169a27449e755219334ddf934429e13da054f5d4
diff --git a/src/main/java/de/ids_mannheim/korap/KrillQuery.java b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
index b12829b..ec028f0 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
@@ -903,6 +903,12 @@
value.append(constraint.get("layer").asText());
value.append(':').append(unit);
unit = value.toString();
+ }
+
+ // Use default foundry and layer - currently only base is supported!
+ else if (unit.equals("s") || unit.equals("p")) {
+ StringBuilder value = new StringBuilder();
+ unit = value.append("base/s:").append(unit).toString();
};
// Sanitize boundary
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index d722038..1e8df6f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -117,6 +117,7 @@
SpanQuery sq;
sq = createQuery("s", "s:b", "s:c", 0, 2, true);
+
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 4);
@@ -228,6 +229,9 @@
SpanQuery sq;
sq = sqwi.toQuery();
+
+ System.err.println(sq.toString());
+
kr = ki.search(sq, (short) 10);
assertEquals((long) 3, kr.getTotalResults());