diff --git a/pom.xml b/pom.xml
index b5fee52..13e0025 100644
--- a/pom.xml
+++ b/pom.xml
@@ -290,7 +290,7 @@
         <dependency>
             <groupId>de.ids_mannheim.korap</groupId>
             <artifactId>Koral</artifactId>
-            <version>0.25</version>
+            <version>0.26</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.eclipse.jetty</groupId>
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java
index 6fcae2f..9d70e36 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewrite.java
@@ -1,63 +1,141 @@
 package de.ids_mannheim.korap.resource.rewrite;
 
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Lists;
 
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.query.object.KoralMatchOperator;
 import de.ids_mannheim.korap.resource.rewrite.KoralNode.RewriteIdentifier;
 import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.User.CorpusAccess;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.utils.KoralCollectionQueryBuilder;
 
 /**
  * @author margaretha
- * @date 22 May 2017
+ * @date 30 May 2017
  */
 public class CollectionRewrite implements RewriteTask.RewriteQuery {
 
-	private static Logger jlog = LoggerFactory.getLogger(CollectionRewrite.class);
+    private static Logger jlog = LoggerFactory
+            .getLogger(CollectionRewrite.class);
+    public static String AVAILABILITY = "availability";
 
-	public CollectionRewrite() {
-		super();
-	}
+    public static Pattern notFreeLicense = Pattern.compile("ACA|QAO");
+    public static Pattern notPublicLicense = Pattern.compile("QAO");
 
-	@Override
-	public JsonNode rewriteQuery(KoralNode node, KustvaktConfiguration config, User user) throws KustvaktException {
-		JsonNode subnode = node.rawNode();
-		KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
-		if (subnode.at("/collection").isMissingNode()) {
-			if (subnode.has("collection")) {
-				builder.setBaseQuery(JsonUtils.toJSON(subnode));
-			}
 
-			switch (user.getCorpusAccess()) {
-			case PUB:
-				builder = new KoralCollectionQueryBuilder();
-				builder.with("availability = /CC-BY.*/ | availablity = /ACA.*/");
-				break;
+    public CollectionRewrite () {
+        super();
+    }
 
-			case ALL:
-				builder = new KoralCollectionQueryBuilder();
-				builder.with("availability = /QAO.*/ | availablity = /ACA.*/ |  availablity = /CC-BY.*/");
-				break;
 
-			default: // FREE
-				builder = new KoralCollectionQueryBuilder();
-				builder.with("availability	 = /CC-BY.*/");
-				break;
-			}
+    private String verifyAvailability (JsonNode node, CorpusAccess access,
+            KustvaktConfiguration config) {
 
-			JsonNode rewritten = JsonUtils.readTree(builder.toJSON()).at("/collection");
-			RewriteIdentifier identifier = new KoralNode.RewriteIdentifier(Attributes.AVAILABILITY,
-					rewritten.at("/value"));
-			node.set("collection", rewritten, identifier);
-			jlog.debug(node.at("/collection").toString());
-		}
+        if (node.has("operands")) {
+            ArrayList<JsonNode> operands = Lists
+                    .newArrayList(node.at("/operands").elements());
+            for (int i = 0; i < operands.size(); i++) {
+                String path = verifyAvailability(operands.get(i), access,
+                        config);
+                if (!path.isEmpty()) { return "/operands/" + i; }
+            }
+        }
+        else if (node.has("key")
+                && node.at("/key").asText().equals(AVAILABILITY)) {
+            Matcher m;
+            String queryAvailability = node.at("/value").asText();
+            if (node.at("/match").asText()
+                    .equals(KoralMatchOperator.EQUALS.toString())) {
 
-		return node.rawNode();
-	}
+                if (access.equals(CorpusAccess.FREE)) {
+                    m = notFreeLicense.matcher(queryAvailability);
+                    if (m.find()) return "/value";
+                }
+                else if (access.equals(CorpusAccess.PUB)) {
+                    m = notPublicLicense.matcher(queryAvailability);
+                    if (m.find()) return "/value";
+                }
+            }
+            // match:ne
+            else {
+                if (access.equals(CorpusAccess.FREE)) {
+                    m = config.getFreeLicensePattern()
+                            .matcher(queryAvailability);
+                    if (m.find()) return "/value";
+                }
+                else if (access.equals(CorpusAccess.PUB)) {
+                    m = config.getPublicLicensePattern()
+                            .matcher(queryAvailability);
+                    if (m.find()) return "/value";
+                }
+            }
+        }
+
+        return "";
+    }
+
+
+    @Override
+    public JsonNode rewriteQuery (KoralNode node, KustvaktConfiguration config,
+            User user) throws KustvaktException {
+        JsonNode jsonNode = node.rawNode();
+        KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
+        switch (user.getCorpusAccess()) {
+            case PUB:
+                builder.with(
+                        "availability = /CC-BY.*/ | availability = /ACA.*/");
+                break;
+            case ALL:
+                builder.with("availability = /QAO.*/ | availability = /ACA.*/ |"
+                        + "  availability = /CC-BY.*/");
+                break;
+            case FREE:
+                builder.with("availability   = /CC-BY.*/");
+                break;
+        }
+
+        RewriteIdentifier identifier = new KoralNode.RewriteIdentifier(
+                Attributes.AVAILABILITY, user.getCorpusAccess());
+        JsonNode rewrittesNode;
+
+        if (jsonNode.has("collection")) {
+            String path = verifyAvailability(jsonNode.at("/collection"),
+                    user.getCorpusAccess(), config);
+            if (!path.isEmpty()) {
+                rewrittesNode = JsonUtils.readTree(builder.toJSON())
+                        .at("/collection");
+                if (path.equals("/value")) {
+                    node.replace("collection", rewrittesNode, identifier);
+                }
+                else {
+                    node.replaceAt("/collection" + path, rewrittesNode,
+                            identifier);
+                }
+            }
+            else {
+                builder.setBaseQuery(builder.toJSON());
+                rewrittesNode = builder.mergeWith(jsonNode).at("/collection");
+                node.set("collection", rewrittesNode, identifier);
+            }
+        }
+        else {
+            rewrittesNode = JsonUtils.readTree(builder.toJSON())
+                    .at("/collection");
+            node.set("collection", rewrittesNode, identifier);
+        }
+
+        jlog.debug("REWRITES: " + node.at("/collection").toString());
+        return node.rawNode();
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
index 6de5552..0614f91 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
@@ -100,7 +100,20 @@
             this.rewrites.add("override", name);
         }
     }
+    
+    public void replaceAt (String path, Object value, RewriteIdentifier ident) {
+        if (this.node.isObject() && !this.node.at(path).isMissingNode()) {
+            ObjectNode n = (ObjectNode) this.node.at(path);
+            n.removeAll();
+            n.putAll((ObjectNode)value);
 
+            String name = path;
+            if (ident != null)
+                name = ident.toString();
+
+            this.rewrites.add("override", name);
+        }
+    }
 
     public void set (String name, Object value, RewriteIdentifier ident) {
         if (this.node.isObject()) {
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
index 3fc69d1..17995bf 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
@@ -205,7 +205,10 @@
 		MultivaluedMap<String, String> headerMap = headers.getRequestHeaders();
 		Location location = Location.EXTERN;
 		CorpusAccess corpusAccess = CorpusAccess.FREE;
-
+		
+		// EM: There is no check for a demo user in intranet?
+		// EM: LDAP user without IP gets CorpusAccess.FREE ?
+		
 		if (headerMap != null && headerMap.containsKey(org.eclipse.jetty.http.HttpHeaders.X_FORWARDED_FOR)) {
 
 			String[] vals = headerMap.getFirst(org.eclipse.jetty.http.HttpHeaders.X_FORWARDED_FOR).split(",");
@@ -217,17 +220,12 @@
 //				if (clientAddress.startsWith("10.0.") || clientAddress.startsWith("172.16.")
 //						|| clientAddress.startsWith("192.168."))
 					location = Location.INTERN;
-				}
-				else{
-					location = Location.EXTERN;
-				}
-				
-				if (location == Location.EXTERN) {
-					corpusAccess = CorpusAccess.PUB;
-				} 
-				else {
 					corpusAccess = CorpusAccess.ALL;
 				}
+				else{
+					corpusAccess = CorpusAccess.PUB;
+				}
+				
 				if (DEBUG_LOG == true) {
 					System.out.printf("Debug: X-Forwarded-For : '%s' (%d values) -> %s\n", vals, vals.length, vals[0]);
 					System.out.printf("Debug: X-Forwarded-For : location = %s corpusAccess = %s\n",
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
index 11169d8..64a5351 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
@@ -470,6 +470,8 @@
 
 
     // was heißt search by name all? FB
+    // EM: ich glaube es ist ALL corpora gemeint (ohne spezifische name), 
+    // weil es searchbyName() auch gibt.
     @SuppressWarnings("unchecked")
     @GET
     @Path("search")
@@ -503,7 +505,7 @@
         serializer.setQuery(q, ql, v);
         if (cq != null)
             serializer.setCollection(cq);
-        	// combine cq with availability CQ according to corpusAccess 
+
         MetaQueryBuilder meta = createMetaQuery(pageIndex, pageInteger, ctx,
                 pageLength, cutoff);
         serializer.setMeta(meta.raw());
@@ -595,8 +597,9 @@
      * @return
      */
     // todo: remove raw
-    @GET
-    @Path("/{type}/{id}/search")
+//    @GET
+//    @Path("/{type}/{id}/search")
+    @Deprecated //EM
     public Response searchbyName (@Context SecurityContext securityContext,
             @Context Locale locale, @QueryParam("q") String query,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
@@ -630,7 +633,9 @@
                 // add collection query
                 KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
                 builder.setBaseQuery(s.toJSON());
-                query = createQuery(user, type, id, builder);
+                //query = createQuery(user, type, id, builder);
+                builder.with(Attributes.CORPUS_SIGLE, "=", id);
+                builder.toJSON();
 
             }
             else {
@@ -648,7 +653,7 @@
             }
 
             String result = doSearch(eng, query, pageLength, meta);
-            KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
+            jlog.debug("The result set: {}", result);
             return Response.ok(result).build();
         }
         catch (KustvaktException e) {
@@ -659,6 +664,7 @@
     }
 
 
+    @Deprecated
     private String createQuery (User user, String type, String id,
             KoralCollectionQueryBuilder builder) {
         KustvaktResource resource = null;
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
index b4f90bb..9bfe2f9 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
@@ -10,6 +10,7 @@
 
 import org.eclipse.jetty.http.HttpHeaders;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
@@ -29,7 +30,7 @@
 
 /**
  * @author hanl, margaretha
- * @lastUpdate 21/04/2017
+ * @lastUpdate 30/05/2017
  *
  */
 public class SearchServiceTest extends FastJerseyTest {
@@ -47,6 +48,7 @@
                 "de.ids_mannheim.korap.web.utils");
     }
 
+
     @Test
     public void testSearchQueryPublicCorpora () {
         ClientResponse response = resource().path(getAPIVersion())
@@ -60,7 +62,7 @@
         assertEquals("koral:doc", node.at("/collection/@type").asText());
         assertEquals("availability", node.at("/collection/key").asText());
         assertEquals("CC-BY.*", node.at("/collection/value").asText());
-        assertEquals("availability(\"CC-BY.*\")",
+        assertEquals("availability(FREE)",
                 node.at("/collection/rewrites/0/scope").asText());
     }
 
@@ -70,8 +72,7 @@
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp").queryParam("cutoff", "true")
-                .queryParam("count", "5")
-                .queryParam("page", "1")
+                .queryParam("count", "5").queryParam("page", "1")
                 .queryParam("context", "40-t,30-t").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
@@ -84,11 +85,12 @@
         assertEquals("token", node.at("/meta/context/left/0").asText());
         assertEquals(40, node.at("/meta/context/left/1").asInt());
         assertEquals(30, node.at("/meta/context/right/1").asInt());
-        assertEquals(-1,node.at("/meta/totalResults").asInt());
+        assertEquals(-1, node.at("/meta/totalResults").asInt());
     }
 
+
     @Test
-    public void testSearchQueryAuthorized () {
+    public void testSearchQueryExternAuthorized () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -103,15 +105,17 @@
         assertNotNull(node);
         assertNotEquals(0, node.path("matches").size());
         assertEquals("koral:docGroup", node.at("/collection/@type").asText());
-        assertEquals("CC-BY.*", node.at("/collection/operands/0/value").asText());
+        assertEquals("CC-BY.*",
+                node.at("/collection/operands/0/value").asText());
         assertEquals("ACA.*", node.at("/collection/operands/1/value").asText());
         assertEquals("operation:or", node.at("/collection/operation").asText());
-        assertEquals("availability()",
+        assertEquals("availability(PUB)",
                 node.at("/collection/rewrites/0/scope").asText());
     }
 
+
     @Test
-    public void testSearchQueryAuthorizedALL () {
+    public void testSearchQueryInternAuthorized () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -127,15 +131,18 @@
         assertNotEquals(0, node.path("matches").size());
         assertEquals("koral:docGroup", node.at("/collection/@type").asText());
         assertEquals("QAO.*", node.at("/collection/operands/0/value").asText());
-        assertEquals("ACA.*", node.at("/collection/operands/1/operands/0/value").asText());
-        assertEquals("CC-BY.*", node.at("/collection/operands/1/operands/1/value").asText());
+        assertEquals("ACA.*",
+                node.at("/collection/operands/1/operands/0/value").asText());
+        assertEquals("CC-BY.*",
+                node.at("/collection/operands/1/operands/1/value").asText());
         assertEquals("operation:or", node.at("/collection/operation").asText());
-        assertEquals("availability()",
+        assertEquals("availability(ALL)",
                 node.at("/collection/rewrites/0/scope").asText());
     }
 
+
     @Test
-    public void testSearchQueryWithCollectionQueryAuthorized () {
+    public void testSearchQueryWithCollectionQueryAuthorizedNoIP () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp")
@@ -148,16 +155,118 @@
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
         assertNotNull(node);
-        assertEquals(2, node.at("/collection/operands").size());
+        assertEquals("operation:insertion",
+                node.at("/collection/rewrites/0/operation").asText());
+        assertEquals("availability(PUB)",
+                node.at("/collection/rewrites/0/scope").asText());
+        // EM: double AND operations
+        assertEquals("availability", node.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*", node.at("/collection/operands/0/value").asText());
         assertEquals("textClass",
-                node.at("/collection/operands/0/key").asText());
+                node.at("/collection/operands/1/operands/0/key").asText());
         assertEquals("corpusSigle",
-                node.at("/collection/operands/1/key").asText());
-        assertEquals("koral:token", node.at("/query/@type").asText());
+                node.at("/collection/operands/1/operands/1/key").asText());
     }
 
 
     @Test
+    public void testSearchQueryWithCollectionQueryUnauthorized () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=das]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("cq", "availability != /CC-BY.*/")
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertEquals("availability", node.at("/collection/key").asText());
+        assertEquals("CC-BY.*", node.at("/collection/value").asText());
+        assertEquals("operation:override",
+                node.at("/collection/rewrites/0/operation").asText());
+        assertEquals("availability(FREE)",
+                node.at("/collection/rewrites/0/scope").asText());
+        assertEquals("koral:token", node.at("/query/@type").asText());
+    }
+    
+    @Test
+    public void testSearchQueryWithComplexCollectionQueryUnauthorized () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=das]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("cq", "textClass=politik & availability != /CC-BY.*/")
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertEquals("textClass", node.at("/collection/operands/0/key").asText());
+        assertEquals("politik", node.at("/collection/operands/0/value").asText());
+        assertEquals("match:eq", node.at("/collection/operands/1/match").asText());
+        assertEquals("availability", node.at("/collection/operands/1/key").asText());
+        assertEquals("CC-BY.*", node.at("/collection/operands/1/value").asText());
+        assertEquals("operation:override",
+                node.at("/collection/rewrites/0/operation").asText());
+        assertEquals("availability(FREE)",
+                node.at("/collection/rewrites/0/scope").asText());
+    }
+    
+    @Test
+    public void testSearchQueryWithComplexCollectionQueryUnauthorized2 () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=das]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("cq", "textClass=politik & availability=ACA-NC")
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertEquals("textClass", node.at("/collection/operands/0/key").asText());
+        assertEquals("politik", node.at("/collection/operands/0/value").asText());
+        assertEquals("match:eq", node.at("/collection/operands/1/match").asText());
+        assertEquals("availability", node.at("/collection/operands/1/key").asText());
+        assertEquals("CC-BY.*", node.at("/collection/operands/1/value").asText());
+        assertEquals("operation:override",
+                node.at("/collection/rewrites/0/operation").asText());
+        assertEquals("availability(FREE)",
+                node.at("/collection/rewrites/0/scope").asText());
+    }
+
+    @Test
+    public void testSearchQueryWithComplexCollectionQueryPublicOverride () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=das]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("cq", "textClass=politik & availability=QAO-NC-LOC:ids")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertEquals("textClass", node.at("/collection/operands/0/key").asText());
+        assertEquals("politik", node.at("/collection/operands/0/value").asText());
+        assertEquals("match:eq", node.at("/collection/operands/1/operands/0/match").asText());
+        assertEquals("availability", node.at("/collection/operands/1/operands/0/key").asText());
+        assertEquals("CC-BY.*", node.at("/collection/operands/1/operands/0/value").asText());
+        assertEquals("match:eq", node.at("/collection/operands/1/operands/1/match").asText());
+        assertEquals("ACA.*", node.at("/collection/operands/1/operands/1/value").asText());
+        assertEquals("operation:override",
+                node.at("/collection/rewrites/0/operation").asText());
+        assertEquals("availability(PUB)",
+                node.at("/collection/rewrites/0/scope").asText());
+    }
+
+
+    @Test
+    @Ignore
     public void testSearchForPublicCorpusWithStringId () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("GOE").path("search")
@@ -168,15 +277,22 @@
         String ent = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
-        assertEquals("koral:doc", node.at("/collection/@type").asText());
-        assertEquals("corpusSigle", node.at("/collection/key").asText());
-        assertEquals("GOE", node.at("/collection/value").asText());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("operation:and",
+                node.at("/collection/operation").asText());
+        assertEquals("availability",
+                node.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*",
+                node.at("/collection/operands/0/value").asText());
+        assertEquals("corpusSigle",
+                node.at("/collection/operands/1/key").asText());
+        assertEquals("GOE", node.at("/collection/operands/1/value").asText());
         assertNotEquals(0, node.path("matches").size());
-        assertEquals(33, node.at("/meta/totalResults").asInt());
     }
 
 
     @Test
+    @Ignore
     public void testSearchForVirtualCollectionWithStringId () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("collection").path("GOE-VC").path("search")
@@ -201,8 +317,9 @@
         assertEquals(1, node.at("/meta/totalResults").asInt());
     }
 
-
+    // EM: non practical use-case
     @Test
+    @Ignore
     public void testSearchForPublicCorpusWithIntegerId ()
             throws KustvaktException {
         Set<Corpus> publicCorpora = ResourceFinder.searchPublic(Corpus.class);
@@ -225,14 +342,22 @@
 
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
-        assertEquals("koral:doc", node.at("/collection/@type").asText());
-        assertEquals("corpusSigle", node.at("/collection/key").asText());
-        assertEquals("GOE", node.at("/collection/value").asText());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("operation:and",
+                node.at("/collection/operation").asText());
+        assertEquals("availability",
+                node.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*",
+                node.at("/collection/operands/0/value").asText());
+        assertEquals("corpusSigle",
+                node.at("/collection/operands/1/key").asText());
+        assertEquals("GOE", node.at("/collection/operands/1/value").asText());
         assertNotEquals(0, node.path("matches").size());
     }
 
 
     @Test
+    @Ignore
     public void testSearchForCorpusWithStringIdUnauthorized () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("WPD15").path("search")
@@ -249,9 +374,10 @@
 
 
     @Test
-    public void testSearchForOwnersCorpusWithStringId () {
+    @Ignore
+    public void testSearchForSpecificCorpus () {
         ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("WPD15").path("search")
+                .path("corpus").path("GOE").path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
@@ -261,15 +387,21 @@
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node);
-        assertEquals("koral:doc", node.at("/collection/@type").asText());
-        assertEquals("corpusSigle", node.at("/collection/key").asText());
-        assertEquals("WPD15", node.at("/collection/value").asText());
-        // EM: sample index does not include this corpus
-//        assertNotEquals(0, node.path("matches").size());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("operation:and",
+                node.at("/collection/operation").asText());
+        assertEquals("availability",
+                node.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*",
+                node.at("/collection/operands/0/value").asText());
+        assertEquals("corpusSigle",
+                node.at("/collection/operands/1/key").asText());
+        assertEquals("GOE", node.at("/collection/operands/1/value").asText());
     }
 
 
     @Test
+    @Ignore
     public void testSearchForOwnersCorpusWithIntegerId ()
             throws KustvaktException {
 
@@ -281,7 +413,7 @@
         String id = null;
         while (i.hasNext()) {
             Corpus c = i.next();
-            if (c.getPersistentID().equals("WPD15")) {
+            if (c.getPersistentID().equals("GOE")) {
                 id = c.getId().toString();
                 //                System.out.println("Corpus "+id);
             }
@@ -297,10 +429,16 @@
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node);
-        assertEquals("koral:doc", node.at("/collection/@type").asText());
-        assertEquals("corpusSigle", node.at("/collection/key").asText());
-        assertEquals("WPD15", node.at("/collection/value").asText());
-//        assertNotEquals(0, node.path("matches").size());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("operation:and",
+                node.at("/collection/operation").asText());
+        assertEquals("availability",
+                node.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*",
+                node.at("/collection/operands/0/value").asText());
+        assertEquals("corpusSigle",
+                node.at("/collection/operands/1/key").asText());
+        assertEquals("GOE", node.at("/collection/operands/1/value").asText());
     }
 
 
