date update, field fix
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaCollectionSerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaCollectionSerializer.java
index 53c90ab..0482480 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaCollectionSerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaCollectionSerializer.java
@@ -84,8 +84,7 @@
         this.tester = tester();
     }
 
-    //resources must be ordered: 0 without parent, 1 has 0 as parent, etc.
-    // what about extend?! is that also part of the VC meta query?!
+    @Deprecated
     public String serialize(String resource) throws IOException {
         Map metas = new HashMap();
         Map<String, String> pa = getParents(resource);
@@ -97,6 +96,18 @@
         metas.put("meta", parids);
         return mapper.writeValueAsString(metas);
     }
+    //resources must be ordered: 0 without parent, 1 has 0 as parent, etc.
+    public List<Map> serialize(List<String> r_queries) throws IOException {
+        Map metas = new HashMap();
+        List<Map> parids = new ArrayList<>();
+        for (String query : r_queries) {
+            Map re = types.mapify(query);
+            parids.add(re);
+        }
+//        metas.put("meta", parids);
+//        return mapper.writeValueAsString(metas);
+        return parids;
+    }
 
     private Map<String, String> getParents(String id) {
         Map<String, String> cursor = getResource(id);
@@ -106,7 +117,6 @@
         if (cursor.get("parent") != null && !cursor.get("parent").isEmpty())
             parents.putAll(getParents(cursor.get("parent")));
         return parents;
-
     }
 
     //todo: connection to database module!
@@ -136,4 +146,6 @@
         return l;
     }
 
+
+
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java
index 150cb5d..8088ecc 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuerySerializer.java
@@ -67,7 +67,7 @@
     public List serializeQueries(Map<String, String> queries, TYPE type) {
         boolean extend, single = true;
         boolean multypes = queries.keySet().size() > 1;
-        List metavalue;
+        List<Map> metavalue;
         String def_key = null;
         if (queries.size() > 1)
             single = false;
@@ -80,14 +80,14 @@
                 break;
         }
 
-        List value = new ArrayList<>();
-        Map<String, String> dates = new LinkedHashMap<>();
+        List value = new LinkedList();
+        List<String> dates = new LinkedList<>();
         for (String key : queries.keySet()) {
             if (!multypes)
                 def_key = key;
-            if (key.contains("~") | key.contains(">") |
-                    key.contains("<")) {
-                dates.put(key, queries.get(key));
+            if (queries.get(key).contains("~") | queries.get(key).contains(">") |
+                    queries.get(key).contains("<")) {
+                dates.add(queries.get(key));
                 continue;
             }
 
@@ -118,7 +118,7 @@
             if (multypes)
                 term = types.createTerm(key, null, queries.get(key).trim(), null);
             else
-                term = types.createTerm(queries.get(key).trim(), null);
+                term = types.createTerm(def_key, null, queries.get(key).trim(), null);
             value.add(term);
         }
 
@@ -129,14 +129,11 @@
             Map term2 = types.createTerm(proc[2], "korap:date");
             Map group = types.createGroup("between", "pubDate", Arrays.asList(term1, term2));
             value.add(group);
-        }
-
-        if (proc[1] != null) {
+        } else if (proc[1] != null) {
             Map term1 = types.createTerm(proc[1], "korap:date");
             Map group = types.createGroup("since", "pubDate", Arrays.asList(term1));
             value.add(group);
-        }
-        if (proc[2] != null) {
+        } else if (proc[2] != null) {
             Map term1 = types.createTerm(proc[2], "korap:date");
             Map group = types.createGroup("until", "pubDate", Arrays.asList(term1));
             value.add(group);
@@ -145,8 +142,9 @@
 
         for (int i = idx; i < proc.length; i++) {
             if (proc[i] != null) {
-                Map term = types.createTerm("pubDate", null, proc[i], "korap:date");
-                value.add(term);
+                Map term1 = types.createTerm(proc[i], "korap:date");
+                Map group = types.createGroup("until", "pubDate", Arrays.asList(term1));
+                value.add(group);
             }
         }
 
@@ -180,26 +178,31 @@
     }
 
     //fixme: only allows for one until and since entry!!
-    private String[] processDates(Map<String, String> dates) {
+    private String[] processDates(List<String> dates) {
         if (dates.isEmpty())
             return new String[3];
-        boolean until = false, since = false;
-        String[] el = new String[dates.keySet().size() + 3];
+        boolean range = false;
+        String[] el = new String[dates.size() + 3];
         int idx = 3;
-        for (String key : dates.keySet()) {
-            if (key.contains("<")) {
-                since = true;
-                el[1] = types.formatDate(Long.valueOf(dates.get(key)), MetaTypes.YMD);
-            } else if (key.contains(">")) {
-                until = true;
-                el[2] = types.formatDate(Long.valueOf(dates.get(key)), MetaTypes.YMD);
+        for (String value : dates) {
+            if (value.contains("<")) {
+                String[] sp = value.split("<");
+                el[1] = types.formatDate(Long.valueOf(sp[1]), MetaTypes.YMD);
+            } else if (value.contains(">")) {
+                String[] sp = value.split(">");
+                el[2] = types.formatDate(Long.valueOf(sp[1]), MetaTypes.YMD);
+            } else if (value.contains("~")) {
+                range = true;
+                String[] sp = value.split("~");
+                el[1] = types.formatDate(Long.valueOf(sp[0]), MetaTypes.YMD);
+                el[2] = types.formatDate(Long.valueOf(sp[1]), MetaTypes.YMD);
             } else {
-                el[idx] = types.formatDate(Long.valueOf(dates.get(key)), MetaTypes.YMD);
+                el[idx] = types.formatDate(Long.valueOf(value), MetaTypes.YMD);
                 idx++;
             }
 
         }
-        if (since && until)
+        if (range)
             el[0] = "r";
         return el;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaSerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaSerializer.java
new file mode 100644
index 0000000..1ed0737
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaSerializer.java
@@ -0,0 +1,42 @@
+package de.ids_mannheim.korap.query.serialize;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 05/12/2013
+ */
+public class MetaSerializer {
+
+
+    private MetaQuerySerializer qs;
+    private MetaCollectionSerializer cs;
+    private ObjectMapper mapper;
+
+
+    public MetaSerializer() {
+        this.qs = new MetaQuerySerializer();
+        this.cs = new MetaCollectionSerializer();
+        this.mapper = new ObjectMapper();
+    }
+
+    public String serializeMeta(List m_queries) throws JsonProcessingException {
+        Map metas = new HashMap();
+        metas.put("meta", m_queries);
+        return mapper.writeValueAsString(metas);
+    }
+
+    public List<Map> serialzeResources(List<String> r_queries) throws IOException {
+        return cs.serialize(r_queries);
+    }
+
+    public List<Map> serializeQueries(Map<String, String> queries, MetaQuerySerializer.TYPE type) {
+        return qs.serializeQueries(queries, type);
+    }
+}
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index 99fb774..ccd0011 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -1,3 +1,6 @@
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import de.ids_mannheim.korap.query.serialize.JsonGenerator;
 import de.ids_mannheim.korap.query.serialize.MetaCollectionSerializer;
 import de.ids_mannheim.korap.query.serialize.MetaQuerySerializer;
 import org.joda.time.DateTime;
@@ -41,29 +44,29 @@
         Map<String, String> j = new HashMap();
         j.put("textClass", "wissenschaft");
         String s = querySerializer.stringify(j, MetaQuerySerializer.TYPE.FILTER);
-//        System.out.println("value reference test single " + s);
+        System.out.println("------ TEXT SINGLE " + s);
     }
 
     @Test
     public void testResourceMeta() throws IOException {
         String s = collSerializer.serialize("25");
-//        System.out.println(" --- RESULT JSON " + s);
+        System.out.println(" --- RESULT JSON " + s);
     }
 
     @Test
     public void testDates() throws IOException {
         Map<String, String> queries = new LinkedHashMap<>();
-        queries.put("<pubDate", String.valueOf(new DateTime().getMillis()));
-        queries.put(">pubDate", String.valueOf(new DateTime().getMillis() + 2));
+        queries.put("pubDate", String.valueOf(new DateTime().getMillis()) + "~"
+                + String.valueOf(new DateTime().getMillis() + 2));
         queries.put("author", "Goethe");
         String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
-//        System.out.println("value : "+ f);
+        System.out.println("value until/since : " + f);
     }
 
     @Test
     public void testUntil() throws IOException {
         Map<String, String> queries = new LinkedHashMap<>();
-        queries.put(">pubDate", String.valueOf(new DateTime().getMillis()));
+        queries.put("pubDate", ">" + String.valueOf(new DateTime().getMillis()));
         queries.put("author", "Hesse");
         String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
         System.out.println("value until : " + f);
@@ -72,10 +75,43 @@
     @Test
     public void testSince() throws IOException {
         Map<String, String> queries = new LinkedHashMap<>();
-        queries.put("<pubDate", String.valueOf(new DateTime().getMillis()));
+        queries.put("pubDate", "<" + String.valueOf(new DateTime().getMillis()));
         queries.put("author", "Kafka");
         String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
         System.out.println("value since : " + f);
     }
 
+    //@Test
+    public void testGenerator() {
+                   /*
+         * just for testing...
+		 */
+        JsonGenerator jg = new JsonGenerator();
+        int i = 0;
+        String[] queries;
+        queries = new String[]{
+                "shrink({[base=foo]})",
+                "shrink({[base=foo]}[orth=bar])",
+                "shrink(1:[base=Der]{1:[base=Mann]})",
+        };
+
+        for (String q : queries) {
+            i++;
+            try {
+                System.out.println(q);
+                jg.run(q, "poliqarp", System.getProperty("user.home") + "/bsp" + i + ".json");
+                System.out.println();
+            } catch (NullPointerException npe) {
+                npe.printStackTrace();
+                System.out.println("null\n");
+            } catch (JsonGenerationException e) {
+                e.printStackTrace();
+            } catch (JsonMappingException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
 }