meta query builder plus test
Change-Id: Ib67c637ec6564f3be0fe7148cb63dc0b31fd1fd0
diff --git a/pom.xml b/pom.xml
index 042468d..2f9e9d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>de.ids_mannheim.korap</groupId>
<artifactId>Koral</artifactId>
- <version>0.2</version>
+ <version>0.21</version>
<packaging>jar</packaging>
<name>Koral</name>
<url>http://maven.apache.org</url>
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java
index 22963a5..f743aba 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQueryBuilder.java
@@ -6,6 +6,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.regex.Pattern;
/**
* @author hanl
@@ -13,12 +14,14 @@
*/
public class MetaQueryBuilder {
+ private static Pattern p = Pattern
+ .compile("\\s*\\d+-(?:c(?:hars?)?|t(?:okens?)?)");
private Map meta;
private SpanContext spanContext;
public MetaQueryBuilder() {
this.meta = new LinkedHashMap();
- this.meta.put("fields", new LinkedList<>());
+ // this.meta.put("fields", new LinkedList<>());
}
/**
@@ -52,7 +55,7 @@
*/
public MetaQueryBuilder setSpanContext(String context) {
if (context != null) {
- if (!context.contains("-") || context.contains(":"))
+ if (!p.matcher(context).find())
this.spanContext = new SpanContext(context);
else {
String[] ct = context.replaceAll("\\s+", "").split(",");
@@ -77,8 +80,6 @@
return meta;
}
-
-
@Data
public class SpanContext {
private String left_type;