Reduce hardwired metadata serialization with support for legacy metadata fields

Change-Id: If401a5b85592eb733e94bbda7a743b20bc6bae9e
diff --git a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
index e0dc582..05f8e6a 100644
--- a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
@@ -17,6 +17,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
+import com.fasterxml.jackson.databind.node.TextNode;
 
 /*
  * Todo:: Author and textClass may be arrays!
@@ -96,9 +97,7 @@
         new HashSet<String>(Arrays.asList(
                                 "pubDate",
                                 "creationDate"
-                                ));
-
-    
+                                ));    
     
     @JsonIgnore
     public int internalDocID, localDocID, UID;
@@ -212,106 +211,6 @@
 
 
     /**
-     * Get the publication date of the document
-     * as a {@link KrillDate} object.
-     * 
-     * @return A {@link KrillDate} object for chaining.
-     */
-    @JsonIgnore
-    public KrillDate getPubDate () {
-        String pubDate = this.getFieldValue("pubDate");
-        if (pubDate == null)
-            return null;
-        return new KrillDate(pubDate);
-    };
-
-
-    /**
-     * Get the publication date of the document
-     * as a string.
-     * 
-     * @return A string containing the {@link KrillDate}.
-     */
-    @JsonProperty("pubDate")
-    public String getPubDateString () {
-        KrillDate pubDate = this.getPubDate();
-
-        if (pubDate != null) {
-            String date = pubDate.toDisplay();
-            if (date.length() == 0)
-                return null;
-            return date;
-        };
-        return null;
-    };
-
-
-    /**
-     * Get the creation date of the document
-     * as a {@link KrillDate} object.
-     * 
-     * @return A {@link KrillDate} object for chaining.
-     */
-    @JsonIgnore
-    public KrillDate getCreationDate () {
-        String creationDate = this.getFieldValue("creationDate");
-        if (creationDate == null)
-            return null;
-        return new KrillDate(creationDate);
-    };
-
-
-    /**
-     * Get the creation date of the document
-     * as a string.
-     * 
-     * @return A string containing the {@link KrillDate}.
-     */
-    @JsonProperty("creationDate")
-    public String getCreationDateString () {
-        KrillDate creationDate = this.getCreationDate();
-
-        if (creationDate != null) {
-            String date = creationDate.toDisplay();
-            if (date.length() == 0)
-                return null;
-            return date;
-        };
-        return null;
-    };
-
-
-    /**
-     * Get the name of the author of the document.
-     * 
-     * @return The name of the author as a string.
-     */
-    public String getAuthor () {
-        return this.getFieldValue("author");
-    };
-
-    
-    /**
-     * Get the text class of the document.
-     * 
-     * @return The text class of the document as a string.
-     */
-    public String getTextClass () {
-        return this.getFieldValue("textClass");
-    };
-
-
-    /**
-     * Get the publication place of the document.
-     * 
-     * @return The publication place of the document as a string.
-     */
-    public String getPubPlace () {
-        return this.getFieldValue("pubPlace");
-    };
-
-
-    /**
      * Get the unique identifier of the document.
      * 
      * @return The unique identifier of the document as an integer.
@@ -355,26 +254,6 @@
 
 
     /**
-     * Get the title of the document.
-     * 
-     * @return The title of the document as a string.
-     */
-    public String getTitle () {
-        return this.getFieldValue("title");
-    };
-
-
-    /**
-     * Get the subtitle of the document.
-     * 
-     * @return The subtitle of the document as a string.
-     */
-    public String getSubTitle () {
-        return this.getFieldValue("subTitle");
-    };
-
-
-    /**
      * Get the primary data of the document.
      * 
      * @return The primary data of the document as a string.
@@ -446,29 +325,6 @@
 
 
     /**
-     * Get information on the foundries the document
-     * is annotated with as a string.
-     * 
-     * @return The foundry information string.
-     */
-    public String getFoundries () {
-        return this.getFieldValue("foundries");
-    };
-
-
-    /**
-     * Get information on the layers the document
-     * is annotated with as a string.
-     * 
-     * @return The layer information string.
-     */
-    public String getLayerInfos () {
-        return this.getFieldValue("layerInfos");
-    };
-
-
-    // This is the new text id
-    /**
      * Get the text sigle as a string.
      * 
      * @return The text sigle as a string.
@@ -478,17 +334,6 @@
     };
 
 
-    // This is the new corpus id
-    /**
-     * Get the corpus sigle as a string.
-     * 
-     * @return The corpus sigle as a string.
-     */
-    public String getCorpusSigle () {
-        return this.getFieldValue("corpusSigle");
-    };
-
-
     /**
      * Get the document sigle as a string.
      * 
@@ -500,224 +345,15 @@
 
 
     /**
-     * Get the name of the publisher as a string.
+     * Get the corpus sigle as a string.
      * 
-     * @return The name of the publisher as a string.
+     * @return The corpus sigle as a string.
      */
-    public String getPublisher () {
-        return this.getFieldValue("publisher");
+    public String getCorpusSigle () {
+        return this.getFieldValue("corpusSigle");
     };
 
 
-    /**
-     * Get the name of the editor as a string.
-     * 
-     * @return The name of the editor as a string.
-     */
-    public String getEditor () {
-        return this.getFieldValue("editor");
-    };
-
-    
-    /**
-     * Get the type of the text as a string.
-     * 
-     * @return The type of the text as a string.
-     */
-    public String getTextType () {
-        return this.getFieldValue("textType");
-    };
-
-
-    /**
-     * Get the type art of the text as a string.
-     * 
-     * @return The type art of the text as a string.
-     */
-    public String getTextTypeArt () {
-        return this.getFieldValue("textTypeArt");
-    };
-
-    /**
-     * Get the type reference of the text as a string.
-     * 
-     * @return The type reference of the text as a string.
-     */
-    public String getTextTypeRef () {
-        return this.getFieldValue("textTypeRef");
-    };
-
-
-    /**
-     * Get the column of the text as a string.
-     * 
-     * @return The column of the text as a string.
-     */
-    public String getTextColumn () {
-        return this.getFieldValue("textColumn");
-    };
-
-
-    /**
-     * Get the domain of the text as a string.
-     * 
-     * @return The domain of the text as a string.
-     */
-    public String getTextDomain () {
-        return this.getFieldValue("textDomain");
-    };
-
-
-	/**
-     * Get the availability of the text as a string.
-     * 
-     * @return The availability of the text as a string.
-     */
-    public String getAvailability () {
-        return this.getFieldValue("availability");
-    };
-    
-
-    /**
-     * Get the file edition statement of the text as a string.
-     * 
-     * @return The file edition statement of the text as a string.
-     */
-    public String getFileEditionStatement () {
-        return this.getFieldValue("fileEditionStatement");
-    };
-
-
-    /**
-     * Get the bibliograhic edition statement of the text as a string.
-     * 
-     * @return The bibliograhic edition statement of the text as a
-     *         string.
-     */
-    public String getBiblEditionStatement () {
-        return this.getFieldValue("biblEditionStatement");
-    };
-
-
-    /**
-     * Get the reference of the text as a string.
-     * 
-     * @return The reference of the text as a string.
-     */
-    public String getReference () {
-        return this.getFieldValue("reference");
-    };
-
-
-    /**
-     * Get the language of the text as a string.
-     * 
-     * @return The language of the text as a string.
-     */
-    public String getLanguage () {
-        return this.getFieldValue("language");
-    };
-
-
-    /**
-     * Get the corpus title of the text as a string.
-     * 
-     * @return The corpus title of the text as a string.
-     */
-    public String getCorpusTitle () {
-        return this.getFieldValue("corpusTitle");
-    };
-
-
-    /**
-     * Get the corpus subtitle of the text as a string.
-     * 
-     * @return The corpus subtitle of the text as a string.
-     */
-    public String getCorpusSubTitle () {
-        return this.getFieldValue("corpusSubTitle");
-    };
-
-
-    /**
-     * Get the corpus author of the text as a string.
-     * 
-     * @return The corpus author of the text as a string.
-     */
-    public String getCorpusAuthor () {
-        return this.getFieldValue("corpusAuthor");
-    };
-
-
-    /**
-     * Get the corpus editor of the text as a string.
-     * 
-     * @return The corpus editor of the text as a string.
-     */
-    public String getCorpusEditor () {
-        return this.getFieldValue("corpusEditor");
-    };
-
-
-    /**
-     * Get the document title of the text as a string.
-     * 
-     * @return The document title of the text as a string.
-     */
-    public String getDocTitle () {
-        return this.getFieldValue("docTitle");
-    };
-
-
-    /**
-     * Get the subtitle of the document of the text as a string.
-     * 
-     * @return The subtitle of the document of the text as a string.
-     */
-    public String getDocSubTitle () {
-        return this.getFieldValue("docSubTitle");
-    };
-
-
-    /**
-     * Get the author of the document of the text as a string.
-     * 
-     * @return The author of the document of the text as a string.
-     */
-    public String getDocAuthor () {
-        return this.getFieldValue("docAuthor");
-    };
-
-
-    /**
-     * Get the editor of the document of the text as a string.
-     * 
-     * @return The editor of the document of the text as a string.
-     */
-    public String getDocEditor () {
-        return this.getFieldValue("docEditor");
-    };
-
-
-    /**
-     * Get the keywords of the text as a string.
-     * 
-     * @return The keywords of the text as a string.
-     */
-    public String getKeywords () {
-        return this.getFieldValue("keywords");
-    };
-
-    /**
-     * Get information about the source of tokenization
-     * as a string.
-     * 
-     * @return The tokenization information as a string.
-     */
-    public String getTokenSource () {
-        return this.getFieldValue("tokenSource");
-    };
-
     @Deprecated
     @JsonProperty("corpusID")
     public String getCorpusID () {
@@ -730,6 +366,90 @@
         return this.getFieldValue("ID");
     };
 
+    @JsonAnyGetter
+    public Map<String, JsonNode> getLegacyMetaFields () {
+        Iterator mfIterator = mFields.iterator();
+
+        HashMap<String, JsonNode> map = new HashMap<>();
+
+        String field;
+        Iterator<String> i = legacyDateFields.iterator();
+        while (i.hasNext()) {
+            field = i.next();
+            if (mFields.contains(field)) {
+                KrillDate date = this.getFieldValueAsDate(field);
+                if (date != null) {
+                    String dateStr = date.toDisplay();
+                    if (dateStr.length() != 0) {
+                        map.put(
+                            field,
+                            new TextNode(dateStr)
+                            );
+                    };
+                };
+            };
+        };
+
+        i = legacyStoredFields.iterator();
+        while (i.hasNext()) {
+            field = i.next();
+            if (mFields.contains(field)) {
+                String value = this.getFieldValue(field);
+                if (value != null) {
+                    map.put(
+                        field,
+                        new TextNode(this.getFieldValue(field))
+                        );
+                };
+            };
+        };
+
+        i = legacyTextFields.iterator();
+        while (i.hasNext()) {
+            field = i.next();
+            if (mFields.contains(field)) {
+                String value = this.getFieldValue(field);
+                if (value != null) {
+                    map.put(
+                        field,
+                        new TextNode(value)
+                        );
+                };
+            };
+        };
+
+        i = legacyStringFields.iterator();
+        while (i.hasNext()) {
+            field = i.next();
+            if (mFields.contains(field)) {
+                String value = this.getFieldValue(field);
+                if (value != null) {
+                    map.put(
+                        field,
+                        new TextNode(value)
+                        );
+                };
+            };
+        };
+
+        i = legacyKeywordsFields.iterator();
+        while (i.hasNext()) {
+            field = i.next();
+            if (mFields.contains(field)) {
+                String value = this.getFieldValue(field);
+                if (value != null) {
+                    map.put(
+                        field,
+                        new TextNode(value)
+                        );
+                };
+            };
+        };
+        
+        return map;
+    }
+
+    
     @JsonAnySetter
     public void setLegacyMetaField (String name, JsonNode value) {
         
@@ -757,7 +477,7 @@
         else if (legacyDateFields.contains(name)) {
             this.addDate(name, value.asText());
         }
-        
+       
         else if (name.equals("license")) {
             this.addString("availability", value.asText());
         }
@@ -790,7 +510,7 @@
     };
 
     @JsonIgnore
-    private String getFieldValue (String field) {
+    public String getFieldValue (String field) {
         MetaField mf = mFields.get(field);
 
         if (mf != null) {
@@ -800,6 +520,17 @@
         return null;
     };
 
+
+    @JsonIgnore
+    public KrillDate getFieldValueAsDate (String field) {
+        String date = this.getFieldValue(field);
+
+        if (date == null)
+            return null;
+
+        return new KrillDate(date);
+    };
+
     @JsonIgnore
     public void addString (String key, String value) {
         mFields.add(
@@ -850,12 +581,13 @@
 
     @JsonIgnore
     public void addDate (String key, String value) {
+        KrillDate date = new KrillDate(value);
         mFields.add(
             key,
             new MetaField(
                 key,
                 "type:date",
-                value
+                date.toDisplay()
                 )
             );
     };
diff --git a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
index 8d96d5c..656f77b 100644
--- a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
@@ -100,18 +100,18 @@
 
     @Override
     public void addDate (String key, String value) {
+        KrillDate date = new KrillDate(value);
+		if (date != null) {
+			this.addInt(key, date.toString());
+		};
         mFields.add(
             key,
             new MetaField(
                 key,
                 "type:date",
-                value
+                date.toDisplay()
                 )
             );
-        KrillDate date = new KrillDate(value);
-		if (date != null) {
-			this.addInt(key, date.toString());
-		};
     }
 
     @Override
@@ -338,10 +338,13 @@
 
                 // Add date field
                 else if (type.equals("type:date")) {
+                    this.addDate(key, field.get("value").asText());
+                    /*
                     KrillDate date = new KrillDate(field.get("value").asText());
                     if (date != null) {
                         this.addInt(key, date.toString());
                     };
+                    */
                 }
 
                 // Unknown
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index 986ad11..f520865 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -1889,7 +1889,6 @@
 
     // Identical to Result!
     public JsonNode toJsonNode () {
-        // ObjectNode json = (ObjectNode) mapper.valueToTree(this);
         ObjectNode json = (ObjectNode) super.toJsonNode();
 
         if (this.context != null)
diff --git a/src/main/java/de/ids_mannheim/korap/response/MetaFields.java b/src/main/java/de/ids_mannheim/korap/response/MetaFields.java
index e2c6f0e..941a137 100644
--- a/src/main/java/de/ids_mannheim/korap/response/MetaFields.java
+++ b/src/main/java/de/ids_mannheim/korap/response/MetaFields.java
@@ -202,13 +202,12 @@
 		
 		ArrayNode fields = doc.putArray("fields");
 
+       
 		// Iterate over all fields
 		Iterator fIter = fieldsMap.keySet().iterator();
 		while (fIter.hasNext()) {
-			// System.err.println(fIter.next());
-			MetaField mf = fieldsMap.get(fIter.next());
-			// System.err.println(mf.type);
-			fields.add(mf.toJsonNode());
+            MetaField mf = fieldsMap.get(fIter.next());
+            fields.add(mf.toJsonNode());
 		};
 
 		return json;
diff --git a/src/main/java/de/ids_mannheim/korap/response/MetaFieldsExt.java b/src/main/java/de/ids_mannheim/korap/response/MetaFieldsExt.java
index 0df6a7d..91dab5a 100644
--- a/src/main/java/de/ids_mannheim/korap/response/MetaFieldsExt.java
+++ b/src/main/java/de/ids_mannheim/korap/response/MetaFieldsExt.java
@@ -26,7 +26,7 @@
 
 import org.apache.lucene.index.*;
 
-public class MetaFieldsExt {
+public class MetaFieldsExt implements Iterable<MetaField> {
 
 	// Logger
 	private final static Logger log = LoggerFactory.getLogger(MetaFields.class);
@@ -161,6 +161,9 @@
 
     /**
 	 * Add field to collection
+     *
+     * @param key
+     *        The key of the field
      */
     public void add (String key, MetaField mf) {
         fieldsMap.put(key, mf);
@@ -169,8 +172,49 @@
 
     /**
 	 * Get field from collection
+     *
+     * @param key
+     *        The key of the field
      */
     public MetaField get (String key) {
         return fieldsMap.get(key);
     };
+
+
+    /**
+	 * Check for field existence.
+     *
+     * @param key
+     *        The key of the field
+     */
+    public Boolean contains (String key) {
+        return fieldsMap.containsKey(key);
+    };
+
+
+    
+    @Override
+    public Iterator<MetaField> iterator() {
+        return new Iterator<MetaField>() {
+
+            private Iterator it = fieldsMap.keySet().iterator();
+                
+            private int currentIndex = 0;
+
+            @Override
+            public boolean hasNext() {
+                return it.hasNext();
+            };
+
+            @Override
+            public MetaField next() {
+                return fieldsMap.get(it.next());
+            };
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            };
+        };
+    };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 30d707d..faf739c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -114,12 +114,12 @@
         assertEquals(fd.getPrimaryData(), "abc");
         assertEquals(fd.getCorpusID(), "WPD");
         assertEquals(fd.getID(), "WPD-AAA-00001");
-        assertEquals(fd.getTextClass(), "music entertainment");
-        assertEquals(fd.getAuthor(), "Peter Frankenfeld");
-        assertEquals(fd.getTitle(), "Wikipedia");
-        assertEquals(fd.getSubTitle(), "Die freie Enzyklopädie");
-        assertEquals(fd.getPubPlace(), "Bochum");
-        assertEquals(fd.getPubDate().toDisplay(), "2013-06-17");
+        assertEquals(fd.getFieldValue("textClass"), "music entertainment");
+        assertEquals(fd.getFieldValue("author"), "Peter Frankenfeld");
+        assertEquals(fd.getFieldValue("title"), "Wikipedia");
+        assertEquals(fd.getFieldValue("subTitle"), "Die freie Enzyklopädie");
+        assertEquals(fd.getFieldValue("pubPlace"), "Bochum");
+        assertEquals(fd.getFieldValueAsDate("pubDate").toDisplay(), "2013-06-17");
 
         QueryBuilder kq = new QueryBuilder("tokens");
         Result kr = ki
@@ -130,12 +130,12 @@
         assertEquals(km.getPrimaryData(), "abc");
         assertEquals(km.getCorpusID(), "WPD");
         assertEquals(km.getDocID(), "WPD-AAA-00001");
-        assertEquals(km.getTextClass(), "music entertainment");
-        assertEquals(km.getAuthor(), "Peter Frankenfeld");
-        assertEquals(km.getTitle(), "Wikipedia");
-        assertEquals(km.getSubTitle(), "Die freie Enzyklopädie");
-        assertEquals(km.getPubPlace(), "Bochum");
-        assertEquals(km.getPubDate().toDisplay(), "2013-06-17");
+        assertEquals(km.getFieldValue("textClass"), "music entertainment");
+        assertEquals(km.getFieldValue("author"), "Peter Frankenfeld");
+        assertEquals(km.getFieldValue("title"), "Wikipedia");
+        assertEquals(km.getFieldValue("subTitle"), "Die freie Enzyklopädie");
+        assertEquals(km.getFieldValue("pubPlace"), "Bochum");
+        assertEquals(km.getFieldValueAsDate("pubDate").toDisplay(), "2013-06-17");
 
         assertEquals(km.getSnippetBrackets(), "a[[{3:b}]]c");
     };
@@ -239,12 +239,12 @@
         assertEquals(fd.getPrimaryData(), "abc");
         assertEquals(fd.getCorpusID(), "WPD");
         assertEquals(fd.getID(), "WPD-AAA-00001");
-        assertEquals(fd.getTextClass(), "music entertainment");
-        assertEquals(fd.getAuthor(), "Peter Frankenfeld");
-        assertEquals(fd.getTitle(), "Wikipedia");
-        assertEquals(fd.getSubTitle(), "Die freie Enzyklopädie");
-        assertEquals(fd.getPubPlace(), "Bochum");
-        assertEquals(fd.getPubDate().toDisplay(), "");
+        assertEquals(fd.getFieldValue("textClass"), "music entertainment");
+        assertEquals(fd.getFieldValue("author"), "Peter Frankenfeld");
+        assertEquals(fd.getFieldValue("title"), "Wikipedia");
+        assertEquals(fd.getFieldValue("subTitle"), "Die freie Enzyklopädie");
+        assertEquals(fd.getFieldValue("pubPlace"), "Bochum");
+        assertEquals(fd.getFieldValueAsDate("pubDate").toDisplay(), "");
 	};
 
     @Test
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestKrillDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestKrillDocument.java
index 34b7421..84fb1b4 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestKrillDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestKrillDocument.java
@@ -27,18 +27,18 @@
     public void createDocument () throws IOException {
         KrillRealDocument krd = new KrillRealDocument();
         krd.addDate("pubDate", "2014-10-12");
-        assertEquals("20141012", krd.getPubDate().toString());
-        assertEquals("2014-10-12", krd.getPubDateString());
+        assertEquals("2014-10-12", krd.getFieldValue("pubDate"));
+        // assertEquals("2014-10-12", krd.getFieldValueAsDate("pubDate").toDisplay());
 
         krd.addDate("creationDate", "2012-09-05");
-        assertEquals("20120905", krd.getCreationDate().toString());
-        assertEquals("2012-09-05", krd.getCreationDateString());
+        assertEquals("2012-09-05", krd.getFieldValue("creationDate"));
+        // assertEquals("2012-09-05", krd.getFieldValueAsDate("creationDate").toDisplay());
 
         krd.addText("author", "Stephen King");
-        assertEquals("Stephen King", krd.getAuthor());
+        assertEquals("Stephen King", krd.getFieldValue("author"));
 
         krd.addString("pubPlace","Düsseldorf");
-        assertEquals("Düsseldorf", krd.getPubPlace());
+        assertEquals("Düsseldorf", krd.getFieldValue("pubPlace"));
 
         krd.setUID(415);
         assertEquals(415, krd.getUID());
@@ -53,10 +53,10 @@
         assertEquals(561, krd.getUID());
 
         krd.addText("title", "An Example");
-        assertEquals("An Example", krd.getTitle());
+        assertEquals("An Example", krd.getFieldValue("title"));
 
         krd.addText("subTitle", "An Example");
-        assertEquals("An Example", krd.getSubTitle());
+        assertEquals("An Example", krd.getFieldValue("subTitle"));
 
         krd.setPrimaryData("We don't need no education");
         assertEquals("We don't need no education", krd.getPrimaryData());
@@ -79,28 +79,28 @@
         assertEquals("U", krd.getCorpusSigle());
 
         krd.addStored("publisher", "Pope Francis");
-        assertEquals("Pope Francis", krd.getPublisher());
+        assertEquals("Pope Francis", krd.getFieldValue("publisher"));
 
         krd.addStored("editor", "Michael Knight");
-        assertEquals("Michael Knight", krd.getEditor());
+        assertEquals("Michael Knight", krd.getFieldValue("editor"));
 
         krd.addString("textType", "shortstory");
-        assertEquals("shortstory", krd.getTextType());
+        assertEquals("shortstory", krd.getFieldValue("textType"));
 
         krd.addString("textTypeArt", "Reportage");
-        assertEquals("Reportage", krd.getTextTypeArt());
+        assertEquals("Reportage", krd.getFieldValue("textTypeArt"));
 
         krd.addString("textTypeRef", "Hm");
-        assertEquals("Hm", krd.getTextTypeRef());
+        assertEquals("Hm", krd.getFieldValue("textTypeRef"));
 
         krd.addString("textColumn", "Feuilleton");
-        assertEquals("Feuilleton", krd.getTextColumn());
+        assertEquals("Feuilleton", krd.getFieldValue("textColumn"));
 
         krd.addString("textDomain", "Comment");
-        assertEquals("Comment", krd.getTextDomain());
+        assertEquals("Comment", krd.getFieldValue("textDomain"));
 
         krd.addString("availability", "cc");
-        assertEquals("cc", krd.getAvailability());
+        assertEquals("cc", krd.getFieldValue("availability"));
 
         /*
 		  krd.setPages("56-78");
@@ -108,36 +108,36 @@
 		*/
 
         krd.addStored("fileEditionStatement", "no problemo 1");
-        assertEquals("no problemo 1", krd.getFileEditionStatement());
+        assertEquals("no problemo 1", krd.getFieldValue("fileEditionStatement"));
 
         krd.addStored("biblEditionStatement", "no problemo 2");
-        assertEquals("no problemo 2", krd.getBiblEditionStatement());
+        assertEquals("no problemo 2", krd.getFieldValue("biblEditionStatement"));
 
         krd.addString("language", "de");
-        assertEquals("de", krd.getLanguage());
+        assertEquals("de", krd.getFieldValue("language"));
 
         krd.addText("corpusTitle", "Mannheimer Morgen");
-        assertEquals("Mannheimer Morgen", krd.getCorpusTitle());
+        assertEquals("Mannheimer Morgen", krd.getFieldValue("corpusTitle"));
 
         krd.addText("corpusSubTitle", "Zeitung für Mannheim");
-        assertEquals("Zeitung für Mannheim", krd.getCorpusSubTitle());
+        assertEquals("Zeitung für Mannheim", krd.getFieldValue("corpusSubTitle"));
 
         krd.addText("corpusAuthor", "Peter Gabriel");
-        assertEquals("Peter Gabriel", krd.getCorpusAuthor());
+        assertEquals("Peter Gabriel", krd.getFieldValue("corpusAuthor"));
 
         krd.addStored("corpusEditor", "Phil Collins");
-        assertEquals("Phil Collins", krd.getCorpusEditor());
+        assertEquals("Phil Collins", krd.getFieldValue("corpusEditor"));
 
         krd.addText("docTitle", "New York Times");
-        assertEquals("New York Times", krd.getDocTitle());
+        assertEquals("New York Times", krd.getFieldValue("docTitle"));
 
         krd.addText("docSubTitle", "Newspaper for New York");
-        assertEquals("Newspaper for New York", krd.getDocSubTitle());
+        assertEquals("Newspaper for New York", krd.getFieldValue("docSubTitle"));
 
         krd.addText("docAuthor", "Dean Baquet");
-        assertEquals("Dean Baquet", krd.getDocAuthor());
+        assertEquals("Dean Baquet", krd.getFieldValue("docAuthor"));
 
         krd.addText("docEditor", "Arthur Ochs Sulzberger Jr.");
-        assertEquals("Arthur Ochs Sulzberger Jr.", krd.getDocEditor());
+        assertEquals("Arthur Ochs Sulzberger Jr.", krd.getFieldValue("docEditor"));
     };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
index fd44110..01f3c86 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
@@ -175,13 +175,13 @@
 
         assertEquals(2, ki.numberOf("base", "documents"));
 
-        assertEquals("Peter", ki.getDoc("22").getTitle());
+        assertEquals("Peter", ki.getDoc("22").getFieldValue("title"));
         assertEquals(22, ki.getDoc("22").getUID());
 
-        assertEquals("Akron", ki.getDoc("5678").getTitle());
+        assertEquals("Akron", ki.getDoc("5678").getFieldValue("title"));
         assertEquals(5678, ki.getDoc("5678").getUID());
 
-        assertEquals("Akron", ki.getDoc("05678").getTitle());
+        assertEquals("Akron", ki.getDoc("05678").getFieldValue("title"));
         assertEquals(5678, ki.getDoc("05678").getUID());
     };
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index 1d6bfaf..607d146 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -975,7 +975,7 @@
 					 km.getSnippetBrackets());
 		
         assertEquals(fd.getTextSigle(), "GOE/AGA/03828");
-        assertEquals(fd.getTitle(), "Autobiographische Einzelheiten");
+        assertEquals(fd.getFieldValue("title"), "Autobiographische Einzelheiten");
 
 		
         Krill ks = new Krill(new QueryBuilder("tokens").seg("marmot/m:case:nom").with("marmot/m:degree:pos"));
@@ -1095,7 +1095,7 @@
 
         Match km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens",
                 null, null, false, false);
-		assertEquals(km.getAvailability(), "CC-BY-SA");
+		assertEquals(km.getFieldValue("availability"), "CC-BY-SA");
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
index b98b791..a92aff4 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
@@ -206,7 +206,7 @@
         assertEquals(4, kr.getMatches().size());
 
         assertEquals("match-GOE/AGI/04846-p107-109", kr.getMatch(0).getID());
-        assertEquals("QAO-NC-LOC:ids", kr.getMatch(0).getAvailability());
+        assertEquals("QAO-NC-LOC:ids", kr.getMatch(0).getFieldValue("availability"));
         assertEquals(
                 "... gelesen und erzählt hat, ich in "
                         + "[[meine Erfahrungen]] hätte mit aufnehmen sollen. "
@@ -215,7 +215,7 @@
 
         assertEquals("match-GOE/AGD/00000-p132566-132569",
                 kr.getMatch(1).getID());
-        assertEquals("QAO-NC-LOC:ids-NU:1", kr.getMatch(1).getAvailability());
+        assertEquals("QAO-NC-LOC:ids-NU:1", kr.getMatch(1).getFieldValue("availability"));
         assertEquals("... Mannes umständlich beibringen und solches "
                 + "durch [[meine eigne Erfahrung]] bekräftigen: das "
                 + "alles sollte nicht gelten ...",
@@ -223,7 +223,7 @@
 
         assertEquals("match-GOE/AGD/00000-p161393-161396",
                 kr.getMatch(2).getID());
-        assertEquals("QAO-NC-LOC:ids-NU:1", kr.getMatch(2).getAvailability());
+        assertEquals("QAO-NC-LOC:ids-NU:1", kr.getMatch(2).getFieldValue("availability"));
         assertEquals("... lassen, bis er sich zuletzt an "
                 + "[[meine sämtlichen Erfahrungen]] und Überzeugungen "
                 + "anschloß, in welchem Sinne ...",
@@ -231,7 +231,7 @@
 
         assertEquals("match-GOE/AGD/06345-p10298-10301",
                 kr.getMatch(3).getID());
-        assertEquals("QAO-NC", kr.getMatch(3).getAvailability());
+        assertEquals("QAO-NC", kr.getMatch(3).getFieldValue("availability"));
         assertEquals("... bis aufs Äußerste verfolgte, und, über "
                 + "[[meine enge Erfahrung]] hinaus, nach ähnlichen Fällen "
                 + "in der ...", kr.getMatch(3).getSnippetBrackets());
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index 87eb365..fda521e 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -508,22 +508,22 @@
         assertEquals(fd.getTextSigle(), "GOE_AGA.03828");
         assertEquals(fd.getDocSigle(), "GOE_AGA");
         assertEquals(fd.getCorpusSigle(), "GOE");
-        assertEquals(fd.getTitle(), "Autobiographische Einzelheiten");
-        assertNull(fd.getSubTitle());
-        assertEquals(fd.getTextType(), "Autobiographie");
-        assertNull(fd.getTextTypeArt());
-        assertNull(fd.getTextTypeRef());
-        assertNull(fd.getTextColumn());
-        assertNull(fd.getTextDomain());
+        assertEquals(fd.getFieldValue("title"), "Autobiographische Einzelheiten");
+        assertNull(fd.getFieldValue("subTitle"));
+        assertEquals(fd.getFieldValue("textType"), "Autobiographie");
+        assertNull(fd.getFieldValue("textTypeArt"));
+        assertNull(fd.getFieldValue("textTypeRef"));
+        assertNull(fd.getFieldValue("textColumn"));
+        assertNull(fd.getFieldValue("textDomain"));
         // assertEquals(fd.getPages(), "529-547");
-        assertEquals(fd.getAvailability(), "QAO-NC");
-        assertEquals(fd.getCreationDate().toString(), "18200000");
-        assertEquals(fd.getPubDate().toString(), "19820000");
-        assertEquals(fd.getAuthor(), "Goethe, Johann Wolfgang von");
-        assertNull(fd.getTextClass());
-        assertEquals(fd.getLanguage(), "de");
-        assertEquals(fd.getPubPlace(), "München");
-        assertEquals(fd.getReference(),
+        assertEquals(fd.getFieldValue("availability"), "QAO-NC");
+        assertEquals(fd.getFieldValue("creationDate"), "1820");
+        assertEquals(fd.getFieldValue("pubDate"), "1982");
+        assertEquals(fd.getFieldValue("author"), "Goethe, Johann Wolfgang von");
+        assertNull(fd.getFieldValue("textClass"));
+        assertEquals(fd.getFieldValue("language"), "de");
+        assertEquals(fd.getFieldValue("pubPlace"), "München");
+        assertEquals(fd.getFieldValue("reference"),
                 "Goethe, Johann Wolfgang von:"
                         + " Autobiographische Einzelheiten,"
                         + " (Geschrieben bis 1832), In: Goethe,"
@@ -531,14 +531,14 @@
                         + " Bd. 10, Autobiographische Schriften"
                         + " II, Hrsg.: Trunz, Erich. München: "
                         + "Verlag C. H. Beck, 1982, S. 529-547");
-        assertEquals(fd.getPublisher(), "Verlag C. H. Beck");
-        assertNull(fd.getEditor());
-        assertNull(fd.getFileEditionStatement());
-        assertNull(fd.getBiblEditionStatement());
-        assertNull(fd.getKeywords());
+        assertEquals(fd.getFieldValue("publisher"), "Verlag C. H. Beck");
+        assertNull(fd.getFieldValue("editor"));
+        assertNull(fd.getFieldValue("fileEditionStatement"));
+        assertNull(fd.getFieldValue("biblEditionStatement"));
+        assertNull(fd.getFieldValue("keywords"));
 
-        assertEquals(fd.getTokenSource(), "opennlp#tokens");
-        assertEquals(fd.getFoundries(),
+        assertEquals(fd.getFieldValue("tokenSource"), "opennlp#tokens");
+        assertEquals(fd.getFieldValue("foundries"),
                 "base base/paragraphs base/sentences corenlp "
                         + "corenlp/constituency corenlp/morpho "
                         + "corenlp/namedentities corenlp/sentences "
@@ -546,22 +546,22 @@
                         + " opennlp opennlp/morpho opennlp/sentences"
                         + " treetagger treetagger/morpho "
                         + "treetagger/sentences");
-        assertEquals(fd.getLayerInfos(),
+        assertEquals(fd.getFieldValue("layerInfos"),
                 "base/s=spans corenlp/c=spans corenlp/ne=tokens"
                         + " corenlp/p=tokens corenlp/s=spans glemm/l=tokens"
                         + " mate/l=tokens mate/m=tokens mate/p=tokens"
                         + " opennlp/p=tokens opennlp/s=spans tt/l=tokens"
                         + " tt/p=tokens tt/s=spans");
 
-        assertEquals(fd.getCorpusTitle(), "Goethes Werke");
-        assertNull(fd.getCorpusSubTitle());
-        assertEquals(fd.getCorpusAuthor(), "Goethe, Johann Wolfgang von");
-        assertEquals(fd.getCorpusEditor(), "Trunz, Erich");
-        assertEquals(fd.getDocTitle(),
+        assertEquals(fd.getFieldValue("corpusTitle"), "Goethes Werke");
+        assertNull(fd.getFieldValue("corpusSubTitle"));
+        assertEquals(fd.getFieldValue("corpusAuthor"), "Goethe, Johann Wolfgang von");
+        assertEquals(fd.getFieldValue("corpusEditor"), "Trunz, Erich");
+        assertEquals(fd.getFieldValue("docTitle"),
                 "Goethe: Autobiographische Schriften II, (1817-1825, 1832)");
-        assertNull(fd.getDocSubTitle());
-        assertNull(fd.getDocEditor());
-        assertNull(fd.getDocAuthor());
+        assertNull(fd.getFieldValue("docSubTitle"));
+        assertNull(fd.getFieldValue("docEditor"));
+        assertNull(fd.getFieldValue("docAuthor"));
 
         Krill ks = new Krill(new QueryBuilder("tokens").seg("mate/m:case:nom")
                 .with("mate/m:number:pl"));
@@ -586,22 +586,22 @@
         assertEquals(fd.getTextSigle(), "GOE/AGA/03828");
         assertEquals(fd.getDocSigle(), "GOE/AGA");
         assertEquals(fd.getCorpusSigle(), "GOE");
-        assertEquals(fd.getTitle(), "Autobiographische Einzelheiten");
-        assertNull(fd.getSubTitle());
-        assertEquals(fd.getTextType(), "Autobiographie");
-        assertNull(fd.getTextTypeArt());
-        assertNull(fd.getTextTypeRef());
-        assertNull(fd.getTextColumn());
-        assertNull(fd.getTextDomain());
+        assertEquals(fd.getFieldValue("title"), "Autobiographische Einzelheiten");
+        assertNull(fd.getFieldValue("subTitle"));
+        assertEquals(fd.getFieldValue("textType"), "Autobiographie");
+        assertNull(fd.getFieldValue("textTypeArt"));
+        assertNull(fd.getFieldValue("textTypeRef"));
+        assertNull(fd.getFieldValue("textColumn"));
+        assertNull(fd.getFieldValue("textDomain"));
         // assertEquals(fd.getPages(), "529-547");
-		// assertEquals(fd.getAvailability(), "QAO-NC");
-        assertEquals(fd.getCreationDate().toString(), "18200000");
-        assertEquals(fd.getPubDate().toString(), "19820000");
-        assertEquals(fd.getAuthor(), "Goethe, Johann Wolfgang von");
-        assertNull(fd.getTextClass());
-        assertEquals(fd.getLanguage(), "de");
-        assertEquals(fd.getPubPlace(), "München");
-        assertEquals(fd.getReference(),
+		// assertEquals(fd.getFieldValue("availability"), "QAO-NC");
+        assertEquals(fd.getFieldValue("creationDate"), "1820");
+        assertEquals(fd.getFieldValue("pubDate"), "1982");
+        assertEquals(fd.getFieldValue("author"), "Goethe, Johann Wolfgang von");
+        assertNull(fd.getFieldValue("textClass"));
+        assertEquals(fd.getFieldValue("language"), "de");
+        assertEquals(fd.getFieldValue("pubPlace"), "München");
+        assertEquals(fd.getFieldValue("reference"),
                 "Goethe, Johann Wolfgang von:"
                         + " Autobiographische Einzelheiten,"
                         + " (Geschrieben bis 1832), In: Goethe,"
@@ -609,27 +609,27 @@
                         + " Bd. 10, Autobiographische Schriften"
                         + " II, Hrsg.: Trunz, Erich. München: "
                         + "Verlag C. H. Beck, 1982, S. 529-547");
-        assertEquals(fd.getPublisher(), "Verlag C. H. Beck");
-        assertNull(fd.getEditor());
-        assertNull(fd.getFileEditionStatement());
-        assertNull(fd.getBiblEditionStatement());
-        assertNull(fd.getKeywords());
+        assertEquals(fd.getFieldValue("publisher"), "Verlag C. H. Beck");
+        assertNull(fd.getFieldValue("editor"));
+        assertNull(fd.getFieldValue("fileEditionStatement"));
+        assertNull(fd.getFieldValue("biblEditionStatement"));
+        assertNull(fd.getFieldValue("keywords"));
 
-        assertEquals(fd.getTokenSource(), "base#tokens_aggr");
-        assertEquals(fd.getFoundries(),
+        assertEquals(fd.getFieldValue("tokenSource"), "base#tokens_aggr");
+        assertEquals(fd.getFieldValue("foundries"),
                 "dereko dereko/structure "+
 					 "dereko/structure/base-sentences-paragraphs-pagebreaks");
-        assertEquals(fd.getLayerInfos(), "dereko/s=spans");
+        assertEquals(fd.getFieldValue("layerInfos"), "dereko/s=spans");
 
-        assertEquals(fd.getCorpusTitle(), "Goethes Werke");
-        assertNull(fd.getCorpusSubTitle());
-        assertEquals(fd.getCorpusAuthor(), "Goethe, Johann Wolfgang von");
-        assertEquals(fd.getCorpusEditor(), "Trunz, Erich");
-        assertEquals(fd.getDocTitle(),
+        assertEquals(fd.getFieldValue("corpusTitle"), "Goethes Werke");
+        assertNull(fd.getFieldValue("corpusSubTitle"));
+        assertEquals(fd.getFieldValue("corpusAuthor"), "Goethe, Johann Wolfgang von");
+        assertEquals(fd.getFieldValue("corpusEditor"), "Trunz, Erich");
+        assertEquals(fd.getFieldValue("docTitle"),
                 "Goethe: Autobiographische Schriften II, (1817-1825, 1832)");
-        assertNull(fd.getDocSubTitle());
-        assertNull(fd.getDocEditor());
-        assertNull(fd.getDocAuthor());
+        assertNull(fd.getFieldValue("docSubTitle"));
+        assertNull(fd.getFieldValue("docEditor"));
+        assertNull(fd.getFieldValue("docAuthor"));
 
         Krill ks = new Krill(new QueryBuilder("tokens").seg("s:der"));
         Result kr = ks.apply(ki);
@@ -660,61 +660,61 @@
         assertEquals(fd.getTextSigle(), "BZK_D59.00089");
         assertEquals(fd.getDocSigle(), "BZK_D59");
         assertEquals(fd.getCorpusSigle(), "BZK");
-        assertEquals(fd.getTitle(), "Saragat-Partei zerfällt");
-        assertEquals(fd.getPubDate().toString(), "19590219");
+        assertEquals(fd.getFieldValue("title"), "Saragat-Partei zerfällt");
+        assertEquals(fd.getFieldValue("pubDate"), "1959-02-19");
 
-        assertNull(fd.getSubTitle());
-        assertNull(fd.getAuthor());
-        assertNull(fd.getEditor());
-        assertEquals(fd.getPubPlace(), "Berlin");
-        assertNull(fd.getPublisher());
-        assertEquals(fd.getTextType(), "Zeitung: Tageszeitung");
-        assertNull(fd.getTextTypeArt());
-        assertEquals(fd.getTextTypeRef(), "Tageszeitung");
-        assertEquals(fd.getTextDomain(), "Politik");
-        assertEquals(fd.getCreationDate().toString(), "19590219");
-        assertEquals(fd.getAvailability(), "ACA-NC-LC");
-        assertEquals(fd.getTextColumn(), "POLITIK");
+        assertNull(fd.getFieldValue("subTitle"));
+        assertNull(fd.getFieldValue("author"));
+        assertNull(fd.getFieldValue("editor"));
+        assertEquals(fd.getFieldValue("pubPlace"), "Berlin");
+        assertNull(fd.getFieldValue("publisher"));
+        assertEquals(fd.getFieldValue("textType"), "Zeitung: Tageszeitung");
+        assertNull(fd.getFieldValue("textTypeArt"));
+        assertEquals(fd.getFieldValue("textTypeRef"), "Tageszeitung");
+        assertEquals(fd.getFieldValue("textDomain"), "Politik");
+        assertEquals(fd.getFieldValue("creationDate"), "1959-02-19");
+        assertEquals(fd.getFieldValue("availability"), "ACA-NC-LC");
+        assertEquals(fd.getFieldValue("textColumn"), "POLITIK");
         // assertNull(fd.getPages());
-        assertEquals(fd.getTextClass(), "politik ausland");
-        assertNull(fd.getFileEditionStatement());
-        assertNull(fd.getBiblEditionStatement());
+        assertEquals(fd.getFieldValue("textClass"), "politik ausland");
+        assertNull(fd.getFieldValue("fileEditionStatement"));
+        assertNull(fd.getFieldValue("biblEditionStatement"));
 
-        assertEquals(fd.getLanguage(), "de");
-        assertEquals(fd.getReference(),
+        assertEquals(fd.getFieldValue("language"), "de");
+        assertEquals(fd.getFieldValue("reference"),
                 "Neues Deutschland, [Tageszeitung], 19.02.1959, Jg. 14,"
                         + " Berliner Ausgabe, S. 7. - Sachgebiet: Politik, "
                         + "Originalressort: POLITIK; Saragat-Partei zerfällt");
-        assertNull(fd.getPublisher());
-        assertNull(fd.getKeywords());
+        assertNull(fd.getFieldValue("publisher"));
+        assertNull(fd.getFieldValue("keywords"));
 
-        assertEquals(fd.getTokenSource(), "opennlp#tokens");
+        assertEquals(fd.getFieldValue("tokenSource"), "opennlp#tokens");
 
-        assertEquals(fd.getFoundries(),
+        assertEquals(fd.getFieldValue("foundries"),
                 "base base/paragraphs base/sentences corenlp "
                         + "corenlp/constituency corenlp/morpho corenlp/namedentities"
                         + " corenlp/sentences glemm glemm/morpho mate mate/morpho"
                         + " opennlp opennlp/morpho opennlp/sentences treetagger"
                         + " treetagger/morpho treetagger/sentences");
 
-        assertEquals(fd.getLayerInfos(),
+        assertEquals(fd.getFieldValue("layerInfos"),
                 "base/s=spans corenlp/c=spans corenlp/ne=tokens"
                         + " corenlp/p=tokens corenlp/s=spans glemm/l=tokens"
                         + " mate/l=tokens mate/m=tokens mate/p=tokens"
                         + " opennlp/p=tokens opennlp/s=spans tt/l=tokens"
                         + " tt/p=tokens tt/s=spans");
 
-        assertEquals(fd.getCorpusTitle(), "Bonner Zeitungskorpus");
-        assertNull(fd.getCorpusSubTitle());
-        assertNull(fd.getCorpusAuthor());
-        assertNull(fd.getCorpusEditor());
+        assertEquals(fd.getFieldValue("corpusTitle"), "Bonner Zeitungskorpus");
+        assertNull(fd.getFieldValue("corpusSubTitle"));
+        assertNull(fd.getFieldValue("corpusAuthor"));
+        assertNull(fd.getFieldValue("corpusEditor"));
 
-        assertEquals(fd.getDocTitle(), "Neues Deutschland");
-        assertEquals(fd.getDocSubTitle(),
+        assertEquals(fd.getFieldValue("docTitle"), "Neues Deutschland");
+        assertEquals(fd.getFieldValue("docSubTitle"),
                 "Organ des Zentralkomitees der Sozialistischen "
                         + "Einheitspartei Deutschlands");
-        assertNull(fd.getDocEditor());
-        assertNull(fd.getDocAuthor());
+        assertNull(fd.getFieldValue("docEditor"));
+        assertNull(fd.getFieldValue("docAuthor"));
 
         Krill ks = new Krill(new QueryBuilder("tokens").seg("mate/m:case:nom")
                 .with("mate/m:number:sg"));
@@ -1265,22 +1265,22 @@
         assertEquals(fd.getTextSigle(), "GOE/AGA/03828");
         assertEquals(fd.getDocSigle(), "GOE/AGA");
         assertEquals(fd.getCorpusSigle(), "GOE");
-        assertEquals(fd.getTitle(), "Autobiographische Einzelheiten");
-        assertNull(fd.getSubTitle());
-        assertEquals(fd.getTextType(), "Autobiographie");
-        assertNull(fd.getTextTypeArt());
-        assertNull(fd.getTextTypeRef());
-        assertNull(fd.getTextColumn());
-        assertNull(fd.getTextDomain());
+        assertEquals(fd.getFieldValue("title"), "Autobiographische Einzelheiten");
+        assertNull(fd.getFieldValue("subTitle"));
+        assertEquals(fd.getFieldValue("textType"), "Autobiographie");
+        assertNull(fd.getFieldValue("textTypeArt"));
+        assertNull(fd.getFieldValue("textTypeRef"));
+        assertNull(fd.getFieldValue("textColumn"));
+        assertNull(fd.getFieldValue("textDomain"));
         // assertEquals(fd.getPages(), "529-547");
-        assertEquals(fd.getAvailability(), "QAO-NC");
-        assertEquals(fd.getCreationDate().toString(), "18200000");
-        assertEquals(fd.getPubDate().toString(), "19820000");
-        assertEquals(fd.getAuthor(), "Goethe, Johann Wolfgang von");
-        assertNull(fd.getTextClass());
-        assertEquals(fd.getLanguage(), "de");
-        assertEquals(fd.getPubPlace(), "München");
-        assertEquals(fd.getReference(),
+        assertEquals(fd.getFieldValue("availability"), "QAO-NC");
+        assertEquals(fd.getFieldValue("creationDate"), "1820");
+        assertEquals(fd.getFieldValue("pubDate"), "1982");
+        assertEquals(fd.getFieldValue("author"), "Goethe, Johann Wolfgang von");
+        assertNull(fd.getFieldValue("textClass"));
+        assertEquals(fd.getFieldValue("language"), "de");
+        assertEquals(fd.getFieldValue("pubPlace"), "München");
+        assertEquals(fd.getFieldValue("reference"),
                 "Goethe, Johann Wolfgang von:"
                         + " Autobiographische Einzelheiten,"
                         + " (Geschrieben bis 1832), In: Goethe,"
@@ -1288,27 +1288,27 @@
                         + " Bd. 10, Autobiographische Schriften"
                         + " II, Hrsg.: Trunz, Erich. München: "
                         + "Verlag C. H. Beck, 1982, S. 529-547");
-        assertEquals(fd.getPublisher(), "Verlag C. H. Beck");
-        assertNull(fd.getEditor());
-        assertNull(fd.getFileEditionStatement());
-        assertNull(fd.getBiblEditionStatement());
-        assertNull(fd.getKeywords());
+        assertEquals(fd.getFieldValue("publisher"), "Verlag C. H. Beck");
+        assertNull(fd.getFieldValue("editor"));
+        assertNull(fd.getFieldValue("fileEditionStatement"));
+        assertNull(fd.getFieldValue("biblEditionStatement"));
+        assertNull(fd.getFieldValue("keywords"));
 
-        assertEquals(fd.getTokenSource(), "base#tokens");
-        assertEquals(fd.getFoundries(),
+        assertEquals(fd.getFieldValue("tokenSource"), "base#tokens");
+        assertEquals(fd.getFieldValue("foundries"),
                 "corenlp corenlp/constituency corenlp/morpho corenlp/sentences dereko dereko/structure dereko/structure/base-sentences-paragraphs-pagebreaks malt malt/dependency marmot marmot/morpho opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho");
-        assertEquals(fd.getLayerInfos(),
+        assertEquals(fd.getFieldValue("layerInfos"),
                 "corenlp/c=spans corenlp/p=tokens corenlp/s=spans dereko/s=spans malt/d=rels marmot/m=tokens marmot/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens");
 
-        assertEquals(fd.getCorpusTitle(), "Goethes Werke");
-        assertNull(fd.getCorpusSubTitle());
-        assertEquals(fd.getCorpusAuthor(), "Goethe, Johann Wolfgang von");
-        assertEquals(fd.getCorpusEditor(), "Trunz, Erich");
-        assertEquals(fd.getDocTitle(),
+        assertEquals(fd.getFieldValue("corpusTitle"), "Goethes Werke");
+        assertNull(fd.getFieldValue("corpusSubTitle"));
+        assertEquals(fd.getFieldValue("corpusAuthor"), "Goethe, Johann Wolfgang von");
+        assertEquals(fd.getFieldValue("corpusEditor"), "Trunz, Erich");
+        assertEquals(fd.getFieldValue("docTitle"),
                 "Goethe: Autobiographische Schriften II, (1817-1825, 1832)");
-        assertNull(fd.getDocSubTitle());
-        assertNull(fd.getDocEditor());
-        assertNull(fd.getDocAuthor());
+        assertNull(fd.getFieldValue("docSubTitle"));
+        assertNull(fd.getFieldValue("docEditor"));
+        assertNull(fd.getFieldValue("docAuthor"));
 
         Krill ks = new Krill(new QueryBuilder("tokens").seg("marmot/m:case:nom")
                 .with("marmot/m:number:pl"));
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
index a66f4fd..59887bd 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
@@ -105,6 +105,7 @@
         assertEquals("match-WPD_AAA.00001-p6-7",
                 res.at("/matches/0/matchID").asText());
         // assertEquals("p6-7", res.at("/matches/0/matchID").asText());
+        assertTrue(res.at("/matches/0/subTitle").isMissingNode());
         assertEquals("", res.at("/matches/0/subTitle").asText());
         assertEquals("", res.at("/matches/0/textClass").asText());
         assertEquals("", res.at("/matches/0/pubPlace").asText());