Removed koralQuery and statistics from VC list

Change-Id: I94b35083bac055e6f46431dea49c4614c459ddc5
diff --git a/full/Changes b/full/Changes
index 7e75465..fa378a7 100644
--- a/full/Changes
+++ b/full/Changes
@@ -3,6 +3,8 @@
 - Updated VC cache.
 2021-12-03
 - Enabled listing system vc for authorized users.
+2021-12-08
+- Removed koralQuery and statistics from VC list.
 
 # version 0.64.1
 2021-10-26
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
index 38cc991..410a58a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
@@ -157,12 +157,18 @@
     private void cacheVC (String vcId, String koralQuery)
             throws IOException, QueryException {
         config.setVcInCaching(vcId);
-        jlog.info("Storing {} in cache ", vcId);
+        if (VirtualCorpusCache.contains(vcId)) {
+            jlog.info("Checking {} in cache ", vcId);
+        }
+        else {
+            jlog.info("Storing {} in cache ", vcId);
+        }
+        
         long start, end;
         start = System.currentTimeMillis();
         VirtualCorpusCache.store(vcId, searchKrill.getIndex());
         end = System.currentTimeMillis();
-        jlog.info("{} Caching duration: {}", vcId, (end - start));
+        jlog.info("Duration : {}", (end - start));
         config.setVcInCaching("");
     }
     
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java
index 4d9052e..3d469a9 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/QueryConverter.java
@@ -20,8 +20,8 @@
 @Component
 public class QueryConverter {
 
-    public QueryDto createQueryDto (QueryDO query,
-            String statistics) throws KustvaktException {
+    public QueryDto createQueryDto (QueryDO query, String statistics)
+            throws KustvaktException {
 
         QueryDto dto = new QueryDto();
         dto.setId(query.getId());
@@ -31,13 +31,13 @@
         dto.setStatus(query.getStatus());
         dto.setDescription(query.getDescription());
         dto.setType(query.getType().displayName());
-        
+
         dto.setQuery(query.getQuery());
         dto.setQueryLanguage(query.getQueryLanguage());
-        
-        JsonNode kq = JsonUtils.readTree(query.getKoralQuery());
-        dto.setKoralQuery(kq);
-        
+
+        // JsonNode kq = JsonUtils.readTree(query.getKoralQuery());
+        // dto.setKoralQuery(kq);
+
         if (statistics != null) {
             JsonNode node = JsonUtils.readTree(statistics);
             dto.setNumberOfDoc(node.at("/documents").asInt());
@@ -46,6 +46,5 @@
             dto.setNumberOfTokens(node.at("/tokens").asInt());
         }
         return dto;
-
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
index 8570f4a..2589406 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
@@ -161,11 +161,11 @@
         Iterator<QueryDO> i = queryList.iterator();
         while (i.hasNext()) {
             query = i.next();
-            String json = query.getKoralQuery();
+//            String json = query.getKoralQuery();
             String statistics = null;
-            if (queryType.equals(QueryType.VIRTUAL_CORPUS)) {
-                statistics = krill.getStatistics(json);
-            }
+//            if (queryType.equals(QueryType.VIRTUAL_CORPUS)) {
+//                statistics = krill.getStatistics(json);
+//            }
             QueryDto dto =
                     converter.createQueryDto(query, statistics);
             dtos.add(dto);
@@ -634,11 +634,15 @@
     public QueryDto retrieveQueryByName (String username, String queryName,
             String createdBy, QueryType queryType) throws KustvaktException {
         QueryDO query = searchQueryByName(username, queryName, createdBy, queryType);
-        String json = query.getKoralQuery();
+//        String json = query.getKoralQuery();
         String statistics = null;
-        if (query.getQueryType().equals(QueryType.VIRTUAL_CORPUS)) {
-            statistics = krill.getStatistics(json);
-        }
+//        long start,end;
+//        start = System.currentTimeMillis();
+//        if (query.getQueryType().equals(QueryType.VIRTUAL_CORPUS)) {
+//            statistics = krill.getStatistics(json);
+//        }
+//        end = System.currentTimeMillis();
+//        jlog.debug("{} statistics duration: {}", queryName, (end - start));
         return converter.createQueryDto(query, statistics);
     }
 
@@ -647,9 +651,9 @@
 
         QueryDO query = queryDao.retrieveQueryById(queryId);
         checkQueryAccess(query, username);
-        String json = query.getKoralQuery();
-        String statistics = krill.getStatistics(json);
-        return converter.createQueryDto(query, statistics);
+//        String json = query.getKoralQuery();
+//        String statistics = krill.getStatistics(json);
+        return converter.createQueryDto(query, null);
     }
 
     private void checkQueryAccess (QueryDO query, String username)
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index f250196..d62769a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -152,6 +152,7 @@
         }
     }
 
+
     /**
      * Lists all virtual corpora available to the authenticated user.
      *
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
index 1188132..5c20c5e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
@@ -362,8 +362,9 @@
         assertEquals(ResourceType.SYSTEM.displayName(),
                 node.at("/0/type").asText());
         assertEquals("\"system\" query", node.at("/0/description").asText());
-        assertEquals("koral:token", node.at("/0/koralQuery/@type").asText());
-
+        assertEquals("[]", node.at("/0/query").asText());
+        assertEquals(CorpusAccess.FREE.name(), node.at("/0/requiredAccess").asText());
+//        assertEquals("koral:token", node.at("/0/koralQuery/@type").asText());
     }
 
     private JsonNode testListAvailableQuery (String username)
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index f38de83..d93bb08 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -119,7 +119,7 @@
         assertEquals("system-vc", node.at("/name").asText());
         assertEquals(ResourceType.SYSTEM.displayName(),
                 node.at("/type").asText());
-        assertEquals("koral:doc", node.at("/koralQuery/collection/@type").asText());
+//        assertEquals("koral:doc", node.at("/koralQuery/collection/@type").asText());
         assertTrue(node.at("/query").isMissingNode());
         assertTrue(node.at("/queryLanguage").isMissingNode());
     }
@@ -732,15 +732,14 @@
                 .path("~dory").path("dory-vc")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
                 .put(ClientResponse.class, json);
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
         // check VC
-        JsonNode node = testListVC("dory");
-        assertEquals("WPD17", node.at("/0/koralQuery/collection/value").asText());
+//        JsonNode node = testListVC("dory");
+//        assertEquals("WPD17", node.at("/0/koralQuery/collection/value").asText());
     }
 
     @Test