Remove metafield redundancies

Change-Id: I4b33005c740398421a29ceb555738696ae471d60
diff --git a/Changes b/Changes
index 5f36b1d..b325da6 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,10 @@
-0.58.4 2019-01-08
+0.58.4 2019-01-09
     - [cleanup] Remove deprecated methods setLicense/getLicense,
       setTokenization/getTokenization, setLayerInfo/getLayerInfo,
       setField/getField (including json serialization)
       (diewald)
+    - [cleanup] Remove redundancy for meta field setting in
+      AbstractDocument and FieldDocument.
 
 0.58.3 2018-12-17
     - [feature] Introduced attachements as meta data fields
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 07c4d8e..bf43557 100644
--- a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
@@ -47,10 +47,8 @@
 
     // private HashMap<String, String> fieldMap;
 
-    private MetaFieldsExt metaFields = new MetaFieldsExt();
-
-    // Deprecated
-    private String ID, corpusID;
+    @JsonIgnore
+    public MetaFieldsExt mFields = new MetaFieldsExt();
 
     /**
      * Populate document meta information with information coming from
@@ -242,8 +240,9 @@
      *            representation.
      * @return A {@link KrillDate} object for chaining.
      */
+    @JsonProperty("pubDate")
     public void setPubDate (String pubDate) {
-        this.addDateX("pubDate", pubDate);
+        this.addDate("pubDate", pubDate);
     };
 
 
@@ -290,8 +289,9 @@
      *            representation.
      * @return A {@link KrillDate} object for chaining.
      */
+    @JsonProperty("creationDate")
     public void setCreationDate (String creationDate) {
-        this.addDateX("creationDate", creationDate);
+        this.addDate("creationDate", creationDate);
     };
 
 
@@ -325,7 +325,7 @@
      *            The name of the author as a string.
      */
     public void setAuthor (String author) {
-        this.addTextX("author", author);
+        this.addText("author", author);
     };
 
 
@@ -346,7 +346,7 @@
      *            The text class of the document as a string.
      */
     public void setTextClass (String textClass) {
-        this.addKeywordsX("textClass", textClass);
+        this.addKeywords("textClass", textClass);
     };
 
 
@@ -367,7 +367,7 @@
      *            The publication place of the document as a string.
      */
     public void setPubPlace (String pubPlace) {
-        this.addStringX("pubPlace", pubPlace);
+        this.addString("pubPlace", pubPlace);
     };
 
 
@@ -390,7 +390,10 @@
      * @return The invocant for chaining.
      */
     public void setUID (int UID) {
-        this.UID = UID;
+        if (UID != 0) {
+            this.UID = UID;
+            this.addString("UID", new Integer(UID).toString());
+        }       
     };
 
 
@@ -406,6 +409,7 @@
     public void setUID (String UID) throws NumberFormatException {
         if (UID != null) {
             this.UID = Integer.parseInt(UID);
+            this.addString("UID", new Integer(this.UID).toString());
         };
     };
 
@@ -427,7 +431,7 @@
      *            The title of the document as a string.
      */
     public void setTitle (String title) {
-        this.addTextX("title", title);
+        this.addText("title", title);
     };
 
 
@@ -448,7 +452,7 @@
      *            The subtitle of the document as a string.
      */
     public void setSubTitle (String subTitle) {
-        this.addTextX("subTitle", subTitle);
+        this.addText("subTitle", subTitle);
     };
 
 
@@ -542,7 +546,7 @@
      *            The foundry information string.
      */
     public void setFoundries (String foundries) {
-        this.addKeywordsX("foundries", foundries);
+        this.addKeywords("foundries", foundries);
     };
 
 
@@ -565,7 +569,7 @@
      *            The layer information string.
      */
     public void setLayerInfos (String layerInfos) {
-        this.addStoredX("layerInfos", layerInfos);
+        this.addStored("layerInfos", layerInfos);
     };
 
 
@@ -588,7 +592,7 @@
      *            The text sigle as a string.
      */
     public void setTextSigle (String textSigle) {
-        this.addStringX("textSigle", textSigle);
+        this.addString("textSigle", textSigle);
     };
 
 
@@ -611,7 +615,7 @@
      *            The corpus sigle as a string.
      */
     public void setCorpusSigle (String corpusSigle) {
-        this.addStringX("corpusSigle", corpusSigle);
+        this.addString("corpusSigle", corpusSigle);
     };
 
 
@@ -632,7 +636,7 @@
      *            The document sigle as a string.
      */
     public void setDocSigle (String docSigle) {
-        this.addStringX("docSigle", docSigle);
+        this.addString("docSigle", docSigle);
     };
 
 
@@ -653,7 +657,7 @@
      *            The name of the publisher as a string.
      */
     public void setPublisher (String publisher) {
-        this.addStoredX("publisher", publisher);
+        this.addStored("publisher", publisher);
     };
 
 
@@ -674,7 +678,7 @@
      *            The name of the editor as a string.
      */
     public void setEditor (String editor) {
-        this.addStoredX("editor", editor);
+        this.addStored("editor", editor);
     };
 
     
@@ -695,7 +699,7 @@
      *            The type of the text as a string.
      */
     public void setTextType (String textType) {
-        this.addStringX("textType", textType);
+        this.addString("textType", textType);
     };
 
 
@@ -716,7 +720,7 @@
      *            The type art of the text as a string.
      */
     public void setTextTypeArt (String textTypeArt) {
-        this.addStringX("textTypeArt", textTypeArt);
+        this.addString("textTypeArt", textTypeArt);
     };
 
 
@@ -727,7 +731,7 @@
      *            The type reference of the text as a string.
      */
     public void setTextTypeRef (String textTypeRef) {
-        this.addStringX("textTypeRef", textTypeRef);
+        this.addString("textTypeRef", textTypeRef);
     };
 
 
@@ -758,7 +762,7 @@
      *            The column of the text as a string.
      */
     public void setTextColumn (String textColumn) {
-        this.addStringX("textColumn", textColumn);
+        this.addString("textColumn", textColumn);
     };
 
 
@@ -779,7 +783,7 @@
      *            The domain of the text as a string.
      */
     public void setTextDomain (String textDomain) {
-        this.addStringX("textDomain", textDomain);
+        this.addString("textDomain", textDomain);
     };
 
 
@@ -800,11 +804,24 @@
      *            The availability of the text as a string.
      */
     public void setAvailability (String availability) {
-        this.addStringX("availability", availability);
+        this.addString("availability", availability);
     };
 
 
     /**
+     * Set the license of the text as a string.
+     * This is a deprecated alias to setAvailability.
+     * 
+     * @param license
+     *            The license of the text as a string.
+     */
+	@Deprecated
+    public void setLicense (String license) {
+        this.setAvailability(license);
+    };
+    
+
+    /**
      * Get the file edition statement of the text as a string.
      * 
      * @return The file edition statement of the text as a string.
@@ -822,7 +839,7 @@
      *            of the text as a string.
      */
     public void setFileEditionStatement (String fileEditionStatement) {
-        this.addStoredX("fileEditionStatement", fileEditionStatement);
+        this.addStored("fileEditionStatement", fileEditionStatement);
     };
 
 
@@ -845,7 +862,7 @@
      *            of the text as a string.
      */
     public void setBiblEditionStatement (String biblEditionStatement) {
-        this.addStoredX("biblEditionStatement", biblEditionStatement);
+        this.addStored("biblEditionStatement", biblEditionStatement);
     };
 
 
@@ -866,7 +883,7 @@
      *            The reference of the text as a string.
      */
     public void setReference (String reference) {
-        this.addStoredX("reference", reference);
+        this.addStored("reference", reference);
     };
 
 
@@ -887,7 +904,7 @@
      *            The language of the text as a string.
      */
     public void setLanguage (String language) {
-        this.addStringX("language", language);
+        this.addString("language", language);
     };
 
 
@@ -908,7 +925,7 @@
      *            The corpus title of the text as a string.
      */
     public void setCorpusTitle (String corpusTitle) {
-        this.addTextX("corpusTitle", corpusTitle);
+        this.addText("corpusTitle", corpusTitle);
     };
 
 
@@ -930,7 +947,7 @@
      *            text as a string.
      */
     public void setCorpusSubTitle (String corpusSubTitle) {
-        this.addTextX("corpusSubTitle", corpusSubTitle);
+        this.addText("corpusSubTitle", corpusSubTitle);
     };
 
 
@@ -950,7 +967,7 @@
      * @return The corpus author of the text as a string.
      */
     public void setCorpusAuthor (String corpusAuthor) {
-        this.addTextX("corpusAuthor", corpusAuthor);
+        this.addText("corpusAuthor", corpusAuthor);
     };
 
 
@@ -971,7 +988,7 @@
      *            The corpus editor of the text as a string.
      */
     public void setCorpusEditor (String corpusEditor) {
-        this.addStoredX("corpusEditor", corpusEditor);
+        this.addStored("corpusEditor", corpusEditor);
     };
 
 
@@ -992,7 +1009,7 @@
      *            The document title of the text as a string.
      */
     public void setDocTitle (String docTitle) {
-        this.addTextX("docTitle", docTitle);
+        this.addText("docTitle", docTitle);
     };
 
 
@@ -1014,7 +1031,7 @@
      *            text as a string.
      */
     public void setDocSubTitle (String docSubTitle) {
-        this.addTextX("docSubTitle", docSubTitle);
+        this.addText("docSubTitle", docSubTitle);
     };
 
 
@@ -1035,7 +1052,7 @@
      *            The author of the document of the text as a string.
      */
     public void setDocAuthor (String docAuthor) {
-        this.addTextX("docAuthor", docAuthor);
+        this.addText("docAuthor", docAuthor);
     };
 
 
@@ -1056,7 +1073,7 @@
      *            The editor of the document of the text as a string.
      */
     public void setDocEditor (String docEditor) {
-        this.addStoredX("docEditor", docEditor);
+        this.addStored("docEditor", docEditor);
     };
 
 
@@ -1077,7 +1094,7 @@
      *            The keywords of the text as a string.
      */
     public void setKeywords (String keywords) {
-        this.addKeywordsX("keywords", keywords);
+        this.addKeywords("keywords", keywords);
     };
 
 
@@ -1100,33 +1117,33 @@
      *            The tokenization information as a string.
      */
     public void setTokenSource (String tokenSource) {
-        this.addStoredX("tokenSource", tokenSource);
+        this.addStored("tokenSource", tokenSource);
     };
 
 
     @Deprecated
     @JsonProperty("corpusID")
     public String getCorpusID () {
-        return this.corpusID;
+        return this.getFieldValue("corpusID");
     };
 
 
     @Deprecated
     public void setCorpusID (String corpusID) {
-        this.corpusID = corpusID;
+        this.addString("corpusID", corpusID);
     };
 
 
     @Deprecated
     @JsonProperty("ID")
     public String getID () {
-        return this.ID;
+        return this.getFieldValue("ID");
     };
 
 
     @Deprecated
     public void setID (String ID) {
-        this.ID = ID;
+        this.addString("ID", ID);
     };
 
 
@@ -1148,18 +1165,18 @@
 
     @JsonIgnore
     private String getFieldValue (String field) {
-        MetaField mf = metaFields.get(field);
+        MetaField mf = mFields.get(field);
 
         if (mf != null) {
-            return metaFields.get(field).values.get(0);
+            return mFields.get(field).values.get(0);
         };
 
         return null;
     };
 
     @JsonIgnore
-    private void addStringX (String key, String value) {
-        metaFields.add(
+    public void addString (String key, String value) {
+        mFields.add(
             key,
             new MetaField(
                 key,
@@ -1170,20 +1187,20 @@
     };
     
     @JsonIgnore
-    private void addStoredX (String key, String value) {
-        metaFields.add(
+    public void addStored (String key, String value) {
+        mFields.add(
             key,
             new MetaField(
                 key,
-                "type:attachement",
+                "type:store",
                 value
                 )
             );
     };
 
     @JsonIgnore
-    private void addKeywordsX (String key, String value) {
-        metaFields.add(
+    public void addKeywords (String key, String value) {
+        mFields.add(
             key,
             new MetaField(
                 key,
@@ -1194,8 +1211,8 @@
     };
 
     @JsonIgnore
-    private void addTextX (String key, String value) {
-        metaFields.add(
+    public void addText (String key, String value) {
+        mFields.add(
             key,
             new MetaField(
                 key,
@@ -1206,8 +1223,8 @@
     };
 
     @JsonIgnore
-    private void addDateX (String key, String value) {
-        metaFields.add(
+    public void addDate (String key, String value) {
+        mFields.add(
             key,
             new MetaField(
                 key,
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 b2c4e98..5334d61 100644
--- a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
@@ -5,6 +5,7 @@
 import de.ids_mannheim.korap.index.AbstractDocument;
 import de.ids_mannheim.korap.util.KrillDate;
 import de.ids_mannheim.korap.util.CorpusDataException;
+import de.ids_mannheim.korap.response.MetaField;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -82,12 +83,6 @@
         tvNoField.setStoreTermVectorOffsets(false);
 
         keywords.setStoreTermVectors(false);
-		/*
-        keywords.setStoreTermVectors(true);
-        keywords.setStoreTermVectorPositions(false);
-        keywords.setStoreTermVectorPayloads(false);
-        keywords.setStoreTermVectorOffsets(false);
-		*/
         keywords.setIndexOptions(IndexOptions.DOCS_AND_FREQS);
     };
 
@@ -98,37 +93,103 @@
         doc.add(new IntField(key, value, Field.Store.YES));
     };
 
-
     public void addInt (String key, String value) {
 		if (value != null)
 			this.addInt(key, Integer.parseInt(value));
     };
 
+    @Override
+    public void addDate (String key, String value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:date",
+                value
+                )
+            );
+        KrillDate date = new KrillDate(value);
+		if (date != null) {
+			this.addInt(key, date.toString());
+		};
+    }
 
+    @Override
     public void addText (String key, String value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:text",
+                value
+                )
+            );
 		doc.add(new TextPrependedField(key, value));
     };
 
 
-    public void addKeyword (String key, String value) {
+    @Override
+    public void addKeywords (String key, String value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:keywords",
+                value
+                )
+            );
+
         doc.add(new Field(key, value, keywords));
     };
 
-
+    @Override
     public void addString (String key, String value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:string",
+                value
+                )
+            );
         doc.add(new StringField(key, value, Field.Store.YES));
     };
 
     public void addAttachement (String key, String value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:attachement",
+                value
+                )
+            );
         doc.add(new StoredField(key, value));
     };    
 
+    @Override
     public void addStored (String key, String value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:store",
+                value
+                )
+            );
         doc.add(new StoredField(key, value));
     };
 
 
     public void addStored (String key, int value) {
+        mFields.add(
+            key,
+            new MetaField(
+                key,
+                "type:store",
+                new Integer(value).toString()
+                )
+            );
         doc.add(new StoredField(key, value));
     };
 
@@ -247,7 +308,7 @@
                         if (sb.length() > 1) {
                             sb.setLength(sb.length() - 1);
                         };
-                        this.addKeyword(key, sb.toString());
+                        this.addKeywords(key, sb.toString());
                     }
                     else {
                         this.addString(key, field.get("value").asText());
@@ -325,304 +386,10 @@
             if (field.containsKey("foundries")) {
                 // TODO: Do not store positions!
                 String foundries = (String) field.get("foundries");
-                this.addKeyword("foundries", foundries);
-                super.setFoundries(foundries);
+                this.setFoundries(foundries);
             };
-            /*
-            if (field.containsKey("tokenization")) {
-                String tokenization = (String) field.get("tokenization");
-                this.addString("tokenization", tokenization);
-                super.setTokenization(tokenization);
-            };
-            */
 
             this.addTV(fieldName, this.getPrimaryData(), mtts);
         };
     };
-
-
-    @Override
-    public void setTextClass (String textClass) {
-        super.setTextClass(textClass);
-        this.addKeyword("textClass", textClass);
-    };
-
-
-    @Override
-    public void setTitle (String title) {
-        super.setTitle(title);
-        this.addText("title", title);
-    };
-
-
-    @Override
-    public void setSubTitle (String subTitle) {
-        super.setSubTitle(subTitle);
-        this.addText("subTitle", subTitle);
-    };
-
-
-    @Override
-    public void setAuthor (String author) {
-        super.setAuthor(author);
-        this.addText("author", author);
-    };
-
-
-    @Override
-    public void setPubPlace (String pubPlace) {
-        super.setPubPlace(pubPlace);
-        this.addString("pubPlace", pubPlace);
-    };
-
-
-    @JsonProperty("pubDate")
-    @Override
-    public void setPubDate (String pubDate) {
-        super.setPubDate(pubDate);
-        KrillDate date = new KrillDate(pubDate);
-		if (date != null) {
-			this.addInt("pubDate", date.toString());
-		};
-    };
-
-
-    @JsonProperty("creationDate")
-    @Override
-    public void setCreationDate (String creationDate) {
-        super.setCreationDate(creationDate);
-        KrillDate date = new KrillDate(creationDate);
-		if (date != null) {
-			this.addInt("creationDate", date.toString());
-		};
-    };
-
-
-    // No longer supported
-    @Override
-    public void setCorpusID (String corpusID) {
-        super.setCorpusID(corpusID);
-        this.addString("corpusID", corpusID);
-    };
-
-
-    // No longer supported
-    @Override
-    public void setID (String ID) {
-        super.setID(ID);
-        this.addString("ID", ID);
-    };
-
-
-    @Override
-    @JsonIgnore
-    public void setUID (int ID) {
-        if (ID != 0) {
-            super.setUID(ID);
-            this.addString("UID", new Integer(ID).toString());
-        }
-    };
-
-
-    @Override
-    public void setUID (String ID) {
-        if (ID != null) {
-            super.setUID(ID);
-            this.addString("UID", new Integer(this.UID).toString());
-        };
-    };
-
-    @Override
-    public void setLayerInfos (String layerInfos) {
-        super.setLayerInfos(layerInfos);
-        this.addStored("layerInfos", layerInfos);
-    };
-
-
-    @Override
-    public void setTextSigle (String textSigle) {
-        super.setTextSigle(textSigle);
-        this.addString("textSigle", textSigle);
-    };
-
-
-    @Override
-    public void setDocSigle (String docSigle) {
-        super.setDocSigle(docSigle);
-        this.addString("docSigle", docSigle);
-    };
-
-
-    @Override
-    public void setCorpusSigle (String corpusSigle) {
-        super.setCorpusSigle(corpusSigle);
-        this.addString("corpusSigle", corpusSigle);
-    };
-
-
-    @Override
-    public void setPublisher (String publisher) {
-        super.setPublisher(publisher);
-        this.addStored("publisher", publisher);
-    };
-
-
-    @Override
-    public void setEditor (String editor) {
-        super.setEditor(editor);
-        this.addStored("editor", editor);
-    };
-
-
-    @Override
-    public void setTextType (String textType) {
-        super.setTextType(textType);
-        this.addString("textType", textType);
-    };
-
-
-    @Override
-    public void setTextTypeArt (String textTypeArt) {
-        super.setTextTypeArt(textTypeArt);
-        this.addString("textTypeArt", textTypeArt);
-    };
-
-
-    @Override
-    public void setTextTypeRef (String textTypeRef) {
-        super.setTextTypeRef(textTypeRef);
-        this.addString("textTypeRef", textTypeRef);
-    };
-
-
-    @Override
-    public void setTextColumn (String textColumn) {
-        super.setTextColumn(textColumn);
-        this.addString("textColumn", textColumn);
-    };
-
-
-    @Override
-    public void setTextDomain (String textDomain) {
-        super.setTextDomain(textDomain);
-        this.addString("textDomain", textDomain);
-    };
-
-
-	@Deprecated
-    public void setLicense (String license) {
-        super.setAvailability(license);
-        this.addString("availability", license);
-    };
-
-
-	@Override
-	public void setAvailability (String availability) {
-        super.setAvailability(availability);
-        this.addString("availability", availability);
-    };
-
-    @Override
-    public void setFileEditionStatement (String fileEditionStatement) {
-        super.setFileEditionStatement(fileEditionStatement);
-        this.addStored("fileEditionStatement", fileEditionStatement);
-    };
-
-
-    @Override
-    public void setBiblEditionStatement (String biblEditionStatement) {
-        super.setBiblEditionStatement(biblEditionStatement);
-        this.addStored("biblEditionStatement", biblEditionStatement);
-    };
-
-
-    @Override
-    public void setReference (String reference) {
-        super.setReference(reference);
-        this.addStored("reference", reference);
-    };
-
-
-    @Override
-    public void setLanguage (String language) {
-        super.setLanguage(language);
-        this.addString("language", language);
-    };
-
-
-    @Override
-    public void setDocTitle (String docTitle) {
-        super.setDocTitle(docTitle);
-        this.addText("docTitle", docTitle);
-    };
-
-
-    @Override
-    public void setDocSubTitle (String docSubTitle) {
-        super.setDocSubTitle(docSubTitle);
-        this.addText("docSubTitle", docSubTitle);
-    };
-
-
-    @Override
-    public void setDocAuthor (String docAuthor) {
-        super.setDocAuthor(docAuthor);
-        this.addText("docAuthor", docAuthor);
-    };
-
-
-    @Override
-    public void setDocEditor (String docEditor) {
-        super.setDocEditor(docEditor);
-        this.addStored("docEditor", docEditor);
-    };
-
-
-    @Override
-    public void setCorpusTitle (String corpusTitle) {
-        super.setCorpusTitle(corpusTitle);
-        this.addText("corpusTitle", corpusTitle);
-    };
-
-
-    @Override
-    public void setCorpusSubTitle (String corpusSubTitle) {
-        super.setCorpusSubTitle(corpusSubTitle);
-        this.addText("corpusSubTitle", corpusSubTitle);
-    };
-
-
-    @Override
-    public void setCorpusAuthor (String corpusAuthor) {
-        super.setCorpusAuthor(corpusAuthor);
-        this.addText("corpusAuthor", corpusAuthor);
-    };
-
-
-    @Override
-    public void setCorpusEditor (String corpusEditor) {
-        super.setCorpusEditor(corpusEditor);
-        this.addStored("corpusEditor", corpusEditor);
-    };
-
-
-    @Override
-    public void setKeywords (String keywords) {
-        super.setKeywords(keywords);
-        this.addKeyword("keywords", keywords);
-    };
-
-
-    @Override
-    public void setTokenSource (String tokenSource) {
-        super.setTokenSource(tokenSource);
-        this.addStored("tokenSource", tokenSource);
-    };
-
-
-    @Override
-    public void setFoundries (String foundries) {
-        super.setFoundries(foundries);
-        this.addKeyword("foundries", foundries);
-    };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
index d9c2832..def7b39 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
@@ -1388,7 +1388,7 @@
         fd.addString("UID", "1");
         fd.addString("ID", "doc-1");
         fd.addString("author", "Frank");
-        fd.addKeyword("textClass", "Nachricht Kultur Reisen");
+        fd.addKeywords("textClass", "Nachricht Kultur Reisen");
         fd.addInt("pubDate", 20051210);
         fd.addText("text", "Der alte  Mann ging über die Straße");
         fd.addTV("tokens", "a b c", "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>3]"
@@ -1402,7 +1402,7 @@
         fd.addString("UID", "2");
 		fd.addString("ID", "doc-2");
         fd.addString("author", "Peter");
-        fd.addKeyword("textClass", "Kultur Reisen");
+        fd.addKeywords("textClass", "Kultur Reisen");
         fd.addInt("pubDate", 20051207);
         fd.addText("text", "Der junge Mann hatte keine andere Wahl");
         fd.addTV("tokens", "a c d", "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>3]"
@@ -1416,7 +1416,7 @@
         fd.addString("UID", "3");
 		fd.addString("ID", "doc-3");
         fd.addString("author", "Sebastian");
-        fd.addKeyword("textClass", "Reisen Finanzen");
+        fd.addKeywords("textClass", "Reisen Finanzen");
         fd.addInt("pubDate", 20051216);
         fd.addText("text", "Die Frau und der Mann küssten sich");
         fd.addTV("tokens", "a d e", "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>3]"
@@ -1429,7 +1429,7 @@
         fd.addString("UID", "5000");
 		fd.addString("ID", "doc-5000");
         fd.addString("author", "Sebastian");
-        fd.addKeyword("textClass", "Kultur Finanzen");
+        fd.addKeywords("textClass", "Kultur Finanzen");
         fd.addInt("pubDate", 20180202);
         fd.addText("text", "Die Frau und der Mann küssten sich");
         fd.addTV("tokens", "a d e", "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>3]"
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 02c9b8e..30d707d 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -335,7 +335,7 @@
         ki.commit();
 
         assertEquals(fd.getPrimaryData(), "abc");
-        assertEquals(fd.doc.getField("corpusID").stringValue(), "WPD");
+        // assertEquals(fd.doc.getField("corpusID").stringValue(), "WPD");
         assertEquals(fd.doc.getField("textSigle").stringValue(), "x/y/z");
         assertEquals(fd.doc.getField("ID").stringValue(), "WPD-AAA-00001");
         assertEquals(fd.doc.getField("textClass").stringValue(), "music entertainment");
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 2c86d10..2e44f61 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
@@ -198,8 +198,8 @@
 		fd.addStored("ref", "My reference");
 		fd.addAttachement("ref2", "data:text/plain;charset=UTF-8,My reference2");
 
-		fd.addKeyword("keyword", "baum");
-		fd.addKeyword("keyword", "wald");
+		fd.addKeywords("keyword", "baum");
+		fd.addKeywords("keyword", "wald");
 
 		fd.addText("title", "Der Name der Rose");
 
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 6a0f710..a66f4fd 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
@@ -225,7 +225,7 @@
         fd.addString("textSigle", "ABC-123-0001");
         fd.addText("title", "Die Wahlverwandschaften");
         fd.addText("author", "Johann Wolfgang von Goethe");
-        fd.addKeyword("textClass", "reisen wissenschaft");
+        fd.addKeywords("textClass", "reisen wissenschaft");
         fd.addInt("pubDate", 20130617);
         fd.addTV("tokens", "abc", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>10]"
                 + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:c|i:c|_2#2-3]");
@@ -237,7 +237,7 @@
         fd2.addString("textSigle", "ABC-125-0001");
         fd2.addText("title", "Die Glocke");
         fd2.addText("author", "Schiller, Friedrich");
-        fd2.addKeyword("textClass", "Reisen geschichte");
+        fd2.addKeywords("textClass", "Reisen geschichte");
         fd2.addInt("pubDate", 20130203);
         fd2.addTV("tokens", "abc", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>10]"
                 + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:c|i:c|_2#2-3]");
@@ -325,7 +325,7 @@
         fd.addString("textSigle", "ABC-123-0002");
         fd.addText("title", "Die Wahlverwandtschaften");
         fd.addText("author", "Johann Wolfgang von Goethe");
-        fd.addKeyword("textClass", "reisen wissenschaft");
+        fd.addKeywords("textClass", "reisen wissenschaft");
         fd.addInt("pubDate", 20130617);
         fd.addTV("tokens", "abc", "[(0-1)s:a|i:a|_0#0-1|-:t$<i>10]"
                 + "[(1-2)s:b|i:b|_1#1-2]" + "[(2-3)s:c|i:c|_2#2-3]");