Limit field retrieval to meta fields in getFieldVector()

Change-Id: Ib71d81368e60e3d830c128c9193d34bc2f66722d
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index 40addf9..75a7acf 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -1888,6 +1888,12 @@
         List fieldValues = new ArrayList<String>();
         String fieldValue;
 
+        // Do not return fieldValues for token fields
+        if (field.equals("tokens") || field.equals("base")) {
+            return fieldValues;
+        };
+
+        
         try {
             final Filter filter = collection.toFilter();
 
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 2b224c3..8fd54f0 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
@@ -430,4 +430,31 @@
         assertEquals("aaaa", fieldValues.get(0));
         assertEquals("cccc", fieldValues.get(1));
     };
+
+    @Test
+    public void indexFieldVectorReal () throws IOException {
+        KrillIndex ki = new KrillIndex();
+
+		// Test with real document
+        ki.addDoc(getClass().getResourceAsStream("/wiki/wdd17-982-72848.json.gz"),true);
+
+        ki.commit();
+
+        CollectionBuilder cb = new CollectionBuilder();
+        KrillCollection kcn = new KrillCollection(ki);
+        
+        List fieldValues = ki.getFieldVector("textSigle", kcn);
+        assertEquals(1, fieldValues.size());
+        assertEquals("WDD17/982/72848", fieldValues.get(0));
+
+        fieldValues = ki.getFieldVector("author", kcn);
+        assertEquals(1, fieldValues.size());
+        assertEquals("ArchivBot, u.a.", fieldValues.get(0));
+
+        fieldValues = ki.getFieldVector("base", kcn);
+        assertEquals(0, fieldValues.size());
+
+        fieldValues = ki.getFieldVector("tokens", kcn);
+        assertEquals(0, fieldValues.size());
+    };
 };