Updated KorapSRU and redirect tests by using mockserver.

Change-Id: I6c15fab0440445304711d9accc16b26a2b835d8c
diff --git a/src/test/java/de/ids_mannheim/korap/test/BaseTest.java b/src/test/java/de/ids_mannheim/korap/test/BaseTest.java
new file mode 100644
index 0000000..4acd467
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/test/BaseTest.java
@@ -0,0 +1,146 @@
+package de.ids_mannheim.korap.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockserver.integration.ClientAndServer.startClientAndServer;
+import static org.mockserver.model.HttpRequest.request;
+import static org.mockserver.model.HttpResponse.response;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.mockserver.client.MockServerClient;
+import org.mockserver.integration.ClientAndServer;
+import org.mockserver.model.Header;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class BaseTest extends KorapJerseyTest {
+    
+    protected DocumentBuilder docBuilder;
+    protected DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+    protected ClientAndServer mockServer;
+    protected MockServerClient mockClient;
+
+    @Before
+    public void startMockServer () {
+        mockServer = startClientAndServer(1080);
+        mockClient = new MockServerClient("localhost", mockServer.getPort());
+    }
+
+    @After
+    public void stopMockServer () {
+        mockServer.stop();
+    }
+    
+    protected void createExpectationForSearchLemmaFein () throws IOException {
+        String searchResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/search-lemma-fein.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient.reset()
+                .when(request().withMethod("GET").withPath("/search")
+                        .withQueryStringParameter("q", "[tt:lemma=\"fein\"]")
+                        .withQueryStringParameter("ql", "fcsql")
+                        .withQueryStringParameter("v", "2.0")
+                        .withQueryStringParameter("context", "sentence")
+                        .withQueryStringParameter("count", "1")
+                        .withQueryStringParameter("offset", "0"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(searchResult).withStatusCode(200));
+    }
+    
+    protected void createExpectationForMatchInfoLemmaFein() throws IOException{
+        String matchInfoResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/GOE-AGF-00000-p4276-4277.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient
+                .when(request().withMethod("GET")
+                        .withPath("/corpus/GOE/AGF/00000/p4276-4277/matchInfo")
+                        .withQueryStringParameter("foundry", "*")
+                        .withQueryStringParameter("spans", "false"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(matchInfoResult).withStatusCode(200));
+    }
+
+    protected void checkSRUSearchRetrieveResponse (InputStream entity)
+            throws SAXException, IOException, ParserConfigurationException {
+
+        docBuilder = factory.newDocumentBuilder();
+        Document doc = docBuilder.parse(entity);
+
+        NodeList nodelist = doc.getElementsByTagName("sruResponse:version");
+        assertEquals("2.0", nodelist.item(0).getTextContent());
+        nodelist = doc.getElementsByTagName("sruResponse:recordSchema");
+        assertEquals("http://clarin.eu/fcs/resource",
+                nodelist.item(0).getTextContent());
+
+        NodeList resources = doc.getElementsByTagName("fcs:Resource");
+        String attr = resources.item(0).getAttributes().getNamedItem("pid")
+                .getNodeValue();
+
+        nodelist = doc.getElementsByTagName("fcs:DataView");
+        attr = nodelist.item(0).getAttributes().getNamedItem("type")
+                .getNodeValue();
+        assertEquals("application/x-clarin-fcs-hits+xml", attr);
+
+        Node node = nodelist.item(0).getFirstChild();
+        assertEquals("hits:Result", node.getNodeName());
+        NodeList children = node.getChildNodes();
+        if (children.getLength() > 1) {
+            assertEquals("hits:Hit", children.item(1).getNodeName());
+        }
+
+        attr = nodelist.item(1).getAttributes().getNamedItem("type")
+                .getNodeValue();
+        assertEquals("application/x-clarin-fcs-adv+xml", attr);
+        node = nodelist.item(1).getFirstChild();
+        assertEquals("adv:Advanced", node.getNodeName());
+
+        nodelist = node.getChildNodes();
+        node = nodelist.item(0);
+        assertEquals("adv:Segments", node.getNodeName());
+        node = nodelist.item(1);
+        assertEquals("adv:Layers", node.getNodeName());
+
+        checkSegmentPosition(resources);
+    }
+
+    protected void checkSegmentPosition (NodeList resources) {
+        // dataviews
+        NodeList childNodes = resources.item(0).getFirstChild().getChildNodes();
+        // segments
+        childNodes = childNodes.item(1).getFirstChild().getChildNodes().item(0)
+                .getChildNodes();
+
+        Node node = childNodes.item(0);
+        // 1st Segment
+        assertEquals("adv:Segment", node.getNodeName());
+        assertEquals("0",
+                node.getAttributes().getNamedItem("start").getNodeValue());
+
+        if (childNodes.getLength() > 3) {
+            // 4th segment
+            node = childNodes.item(3);
+            assertEquals("0",
+                    node.getAttributes().getNamedItem("start").getNodeValue());
+        }
+    }
+}
diff --git a/src/test/java/de/ids_mannheim/korap/test/KorapClientTest.java b/src/test/java/de/ids_mannheim/korap/test/KorapClientTest.java
index dee9022..341f91d 100644
--- a/src/test/java/de/ids_mannheim/korap/test/KorapClientTest.java
+++ b/src/test/java/de/ids_mannheim/korap/test/KorapClientTest.java
@@ -18,12 +18,6 @@
 /**
  * The tests are based on the sample corpus from the Goethe corpus.
  * 
- * The tests require a running KustvaktServer.
- * Specify the Kustvakt service URI at
- * /KorapSRU/src/main/webapp/WEB-INF/web.xml
- * 
- * and in the initialization of KorapClient in the code below.
- * 
  * @author margaretha
  *
  */
@@ -33,14 +27,16 @@
     private KorapMatch match;
     
     public KorapClientTest () {
-        c = new KorapClient("http://localhost:8089/api/v1.0", 25, 50);
+        c = new KorapClient("http://localhost:1080/api/v1.0", 25, 50);
     }
 
     @Test
     public void testCQLQuery () throws HttpResponseException, IOException {
-        result = c.query("der", QueryLanguage.CQL, "1.2", 1, 25,
+        
+        
+        result = c.query("der", QueryLanguage.CQL, "1.2", 1, 1,
                 null);
-        assertEquals(25, result.getMatchSize());
+        assertEquals(1, result.getMatchSize());
         assertEquals(1858, result.getTotalResults());
     
         match = result.getMatch(0);
diff --git a/src/test/java/de/ids_mannheim/korap/test/KorapSRUTest.java b/src/test/java/de/ids_mannheim/korap/test/KorapSRUTest.java
index 431033d..b620674 100644
--- a/src/test/java/de/ids_mannheim/korap/test/KorapSRUTest.java
+++ b/src/test/java/de/ids_mannheim/korap/test/KorapSRUTest.java
@@ -1,7 +1,6 @@
 package de.ids_mannheim.korap.test;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockserver.integration.ClientAndServer.startClientAndServer;
 import static org.mockserver.model.HttpRequest.request;
 import static org.mockserver.model.HttpResponse.response;
 
@@ -10,21 +9,14 @@
 import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.http.client.ClientProtocolException;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
-import org.mockserver.client.MockServerClient;
-import org.mockserver.integration.ClientAndServer;
 import org.mockserver.model.Header;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
@@ -33,258 +25,320 @@
 /**
  * The tests are based on the sample corpus from the Goethe corpus.
  * 
- * The tests require a running KustvaktServer.
- * Specify the Kustvakt service URI at
- * /KorapSRU/src/main/webapp/WEB-INF/web.xml
- * 
  * @author margaretha
  *
  */
-public class KorapSRUTest extends KorapJerseyTest{
-	private DocumentBuilder docBuilder;
-	
-	private ClientAndServer mockServer;
-    private MockServerClient mockClient;
-    
-	@Before
-    public void startMockServer () {
-        mockServer = startClientAndServer(1080);
-        mockClient = new MockServerClient("localhost", mockServer.getPort());
+public class KorapSRUTest extends BaseTest {
+
+    public KorapSRUTest () throws ParserConfigurationException {
+        docBuilder = factory.newDocumentBuilder();
     }
-	
-	@After
-    public void stopMockServer () {
-        mockServer.stop();
+
+    private void createExpectationForSearchFein () throws IOException {
+        String searchResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/search-fein.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient.reset()
+                .when(request().withMethod("GET").withPath("/search")
+                        .withQueryStringParameter("q", "fein")
+                        .withQueryStringParameter("ql", "cql")
+                        .withQueryStringParameter("v", "2.0")
+                        .withQueryStringParameter("context", "sentence")
+                        .withQueryStringParameter("count", "25")
+                        .withQueryStringParameter("offset", "0"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(searchResult).withStatusCode(200));
     }
-	
-	public KorapSRUTest() throws ParserConfigurationException {
-		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-		docBuilder = factory.newDocumentBuilder();
-	}
-	
-	@Test
-	public void searchRetrieveCQLTest() throws IOException, SAXException{
-	    ClientResponse response = resource().queryParam("operation", "searchRetrieve")
-                .queryParam("query", "fein")
-                .get(ClientResponse.class);
 
-	    InputStream entity = response.getEntity(InputStream.class);
-        checkSRUSearchRetrieveResponse(entity);
-	}
-	
-	@Test
-    public void searchRetrieveCQLTestWithStartRecord() throws IOException, SAXException{
-        ClientResponse response = resource().queryParam("operation", "searchRetrieve")
-                .queryParam("query", "der")
-                .queryParam("startRecord", "51")
-                .get(ClientResponse.class);
-      InputStream entity = response.getEntity(InputStream.class);
-      Document doc = docBuilder.parse(entity);
-      
-      NodeList nodelist = doc.getElementsByTagName("sruResponse:recordPosition");
-      assertEquals("51", nodelist.item(0).getTextContent());
-    } 
-	
-	@Test
-	public void searchRetrieveFCSQLTest() throws IOException, SAXException{
-	    ClientResponse response = resource().queryParam("operation", "searchRetrieve")
-                .queryParam("query", "[tt:lemma=\"fein\"]")
-                .queryParam("queryType", "fcs")
-                .queryParam("maximumRecords", "5")
-                .get(ClientResponse.class);
-        
-//	    String entity = response.getEntity(String.class);
-//	    System.out.println(entity);
-//	    ByteArrayInputStream bis = new ByteArrayInputStream(entity.getBytes());
-//	    checkSRUSearchRetrieveResponse(bis);
-	    
-        InputStream entity = response.getEntity(InputStream.class);
-		checkSRUSearchRetrieveResponse(entity);
-	} 
-	
-	private void checkSRUSearchRetrieveResponse(InputStream entity) throws SAXException, IOException {
-		
-		Document doc = docBuilder.parse(entity);
-		
-		NodeList nodelist = doc.getElementsByTagName("sruResponse:version");
-		assertEquals("2.0", nodelist.item(0).getTextContent());
-		nodelist = doc.getElementsByTagName("sruResponse:recordSchema");
-		assertEquals("http://clarin.eu/fcs/resource", nodelist.item(0).getTextContent());
-		
-		NodeList resources = doc.getElementsByTagName("fcs:Resource");
-		String attr  = resources.item(0).getAttributes().getNamedItem("pid").getNodeValue();
-		
-		nodelist = doc.getElementsByTagName("fcs:DataView");
-		attr = nodelist.item(0).getAttributes().getNamedItem("type").getNodeValue();
-		assertEquals("application/x-clarin-fcs-hits+xml", attr);
-		
-		Node node = nodelist.item(0).getFirstChild();
-		assertEquals("hits:Result", node.getNodeName());
-		NodeList children = node.getChildNodes();
-		assertEquals("hits:Hit", children.item(1).getNodeName());
-		
-		attr = nodelist.item(1).getAttributes().getNamedItem("type").getNodeValue();
-		assertEquals("application/x-clarin-fcs-adv+xml", attr);
-		node = nodelist.item(1).getFirstChild();
-		assertEquals("adv:Advanced", node.getNodeName());
-		
-		nodelist = node.getChildNodes();
-		node = nodelist.item(0);
-		assertEquals("adv:Segments", node.getNodeName());
-		node = nodelist.item(1);
-		assertEquals("adv:Layers", node.getNodeName());
-		
-		checkSegmentPosition(resources);
-	}
-	
-	
-	private void checkSegmentPosition (NodeList resources) {
-        // dataviews
-        NodeList childNodes = resources.item(1).getFirstChild().getChildNodes();
-        // segments
-        childNodes = childNodes.item(1).getFirstChild().getChildNodes().item(0)
-                .getChildNodes();
+    private void createExpectationForMatchInfoFein () throws IOException {
+        String matchInfoResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/GOE-AGF-00000-p15205-15206.jsonld"),
+                StandardCharsets.UTF_8);
 
-        Node node = childNodes.item(0);
-        // 1st Segment
-        assertEquals("adv:Segment", node.getNodeName());
-        assertEquals("0",
-                node.getAttributes().getNamedItem("start").getNodeValue());
+        mockClient
+                .when(request().withMethod("GET")
+                        .withPath(
+                                "/corpus/GOE/AGF/00000/p15205-15206/matchInfo")
+                        .withQueryStringParameter("foundry", "*")
+                        .withQueryStringParameter("spans", "false"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(matchInfoResult).withStatusCode(200));
 
-        // 4th segment
-        node = childNodes.item(3);
-        assertEquals("0",
-                node.getAttributes().getNamedItem("start").getNodeValue());
+        matchInfoResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/GOE-AGF-00000-p15216-15217.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient
+                .when(request().withMethod("GET")
+                        .withPath(
+                                "/corpus/GOE/AGF/00000/p15216-15217/matchInfo")
+                        .withQueryStringParameter("foundry", "*")
+                        .withQueryStringParameter("spans", "false"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(matchInfoResult).withStatusCode(200));
+
+        matchInfoResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/GOE-AGF-00000-p45002-45003.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient
+                .when(request().withMethod("GET")
+                        .withPath(
+                                "/corpus/GOE/AGF/00000/p45002-45003/matchInfo")
+                        .withQueryStringParameter("foundry", "*")
+                        .withQueryStringParameter("spans", "false"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(matchInfoResult).withStatusCode(200));
+
     }
 
     @Test
-    public void searchRetrieveWithResourceId() throws IOException, URISyntaxException, IllegalStateException, SAXException{
-	    ClientResponse response = resource().queryParam("operation", "searchRetrieve")
-                .queryParam("query", "fein")
-                .queryParam("x-fcs-context", "GOE")
-                .get(ClientResponse.class);
-        
-	    InputStream entity = response.getEntity(InputStream.class);
-        checkSRUSearchRetrieveResponse(entity);
-    } 
-	
-	@Test
-	public void explainTest() throws URISyntaxException, ClientProtocolException, IOException, IllegalStateException, SAXException{
-	    
-	    ClientResponse response = resource().queryParam("operation", "explain")
-                .get(ClientResponse.class);
-        
+    public void searchRetrieveCQLTest ()
+            throws IOException, SAXException, ParserConfigurationException {
+        createExpectationForSearchFein();
+        createExpectationForMatchInfoFein();
+
+        ClientResponse response =
+                resource().queryParam("operation", "searchRetrieve")
+                        .queryParam("query", "fein").get(ClientResponse.class);
+
         InputStream entity = response.getEntity(InputStream.class);
-        
-		assertEquals(200,response.getStatus());
-		
-		Document doc = docBuilder.parse(entity);
-		NodeList nodelist = doc.getElementsByTagName("sruResponse:version");
-		assertEquals("2.0", nodelist.item(0).getTextContent());
-		
-		nodelist = doc.getElementsByTagName("sruResponse:recordSchema");
-		assertEquals("http://explain.z3950.org/dtd/2.0/", nodelist.item(0).getTextContent());
-		
-		nodelist = doc.getElementsByTagName("zr:serverInfo");
-		NamedNodeMap attributes = nodelist.item(0).getAttributes();
-		assertEquals("SRU", attributes.getNamedItem("protocol").getNodeValue());
-		assertEquals("2.0", attributes.getNamedItem("version").getNodeValue()); 
-		assertEquals("http", attributes.getNamedItem("transport").getNodeValue());
-		
-		NodeList children = nodelist.item(0).getChildNodes();
-		assertEquals("zr:host", children.item(0).getNodeName());
-		assertEquals("127.0.0.1", children.item(0).getTextContent());
-		assertEquals("zr:port", children.item(1).getNodeName());
-		assertEquals("8080", children.item(1).getTextContent());
-		assertEquals("zr:database", children.item(2).getNodeName());
-		assertEquals("korapsru", children.item(2).getTextContent());
-		
-		nodelist = doc.getElementsByTagName("zr:databaseInfo");
-		children = nodelist.item(0).getChildNodes();
-		assertEquals("zr:title", children.item(0).getNodeName());
-		assertEquals("KorAP", children.item(0).getTextContent());
-		
-		nodelist = doc.getElementsByTagName("zr:indexInfo");
-		children = nodelist.item(0).getChildNodes();
-		assertEquals("zr:set", children.item(0).getNodeName());
-		assertEquals("http://clarin.eu/fcs/resource", children.item(0).getAttributes().getNamedItem("identifier").getNodeValue());
-		assertEquals("fcs", children.item(0).getAttributes().getNamedItem("name").getNodeValue());
-		
-		nodelist = doc.getElementsByTagName("zr:schemaInfo");
-		children = nodelist.item(0).getChildNodes();
-		assertEquals("zr:schema", children.item(0).getNodeName());
-		assertEquals("http://clarin.eu/fcs/resource", children.item(0).getAttributes().getNamedItem("identifier").getNodeValue());
-		assertEquals("fcs", children.item(0).getAttributes().getNamedItem("name").getNodeValue());
-		
-		nodelist = doc.getElementsByTagName("zr:configInfo");
-		children = nodelist.item(0).getChildNodes();
-		assertEquals("numberOfRecords", children.item(0).getAttributes().getNamedItem("type").getNodeValue());
-		assertEquals("25", children.item(0).getTextContent());
-		assertEquals("numberOfRecords", children.item(0).getAttributes().getNamedItem("type").getNodeValue());
-		assertEquals("50", children.item(1).getTextContent());
-		
-		nodelist = doc.getElementsByTagName("ed:EndpointDescription");
-		assertEquals(0, nodelist.getLength());
-	}
-	
-	@Test
-	public void explainEndpointDescriptionTest() throws URISyntaxException, ClientProtocolException, IOException, IllegalStateException, SAXException{
-	    
-	    String korapResources = IOUtils.toString(
+        checkSRUSearchRetrieveResponse(entity);
+    }
+
+    @Test
+    public void searchRetrieveWithResourceId ()
+            throws IOException, URISyntaxException, IllegalStateException,
+            SAXException, ParserConfigurationException {
+        createExpectationForSearchFein();
+        createExpectationForMatchInfoFein();
+
+        ClientResponse response = resource()
+                .queryParam("operation", "searchRetrieve")
+                .queryParam("query", "fein").queryParam("x-fcs-context", "GOE")
+                .get(ClientResponse.class);
+
+        InputStream entity = response.getEntity(InputStream.class);
+        checkSRUSearchRetrieveResponse(entity);
+    }
+
+    @Test
+    public void searchRetrieveFCSQLTest ()
+            throws IOException, SAXException, ParserConfigurationException {
+
+        createExpectationForSearchLemmaFein();
+        createExpectationForMatchInfoLemmaFein();
+
+        ClientResponse response = resource()
+                .queryParam("operation", "searchRetrieve")
+                .queryParam("query", "[tt:lemma=\"fein\"]")
+                .queryParam("queryType", "fcs")
+                .queryParam("maximumRecords", "1").get(ClientResponse.class);
+
+        InputStream entity = response.getEntity(InputStream.class);
+        checkSRUSearchRetrieveResponse(entity);
+    }
+
+    @Test
+    public void searchRetrieveCQLTestWithStartRecord ()
+            throws IOException, SAXException {
+
+        String searchResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/search-der.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient.reset()
+                .when(request().withMethod("GET").withPath("/search")
+                        .withQueryStringParameter("q", "der")
+                        .withQueryStringParameter("ql", "cql")
+                        .withQueryStringParameter("v", "2.0")
+                        .withQueryStringParameter("context", "sentence")
+                        .withQueryStringParameter("count", "1")
+                        .withQueryStringParameter("offset", "50"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(searchResult).withStatusCode(200));
+
+        String matchInfoResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/GOE-AGA-01784-p1856-1857.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient
+                .when(request().withMethod("GET")
+                        .withPath("/corpus/GOE/AGA/01784/p1856-1857/matchInfo")
+                        .withQueryStringParameter("foundry", "*")
+                        .withQueryStringParameter("spans", "false"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(matchInfoResult).withStatusCode(200));
+
+        ClientResponse response = resource()
+                .queryParam("operation", "searchRetrieve")
+                .queryParam("query", "der").queryParam("startRecord", "51")
+                .queryParam("maximumRecords", "1").get(ClientResponse.class);
+        InputStream entity = response.getEntity(InputStream.class);
+        Document doc = docBuilder.parse(entity);
+
+        NodeList nodelist =
+                doc.getElementsByTagName("sruResponse:recordPosition");
+        assertEquals("51", nodelist.item(0).getTextContent());
+    }
+
+    @Test
+    public void explainTest ()
+            throws URISyntaxException, ClientProtocolException, IOException,
+            IllegalStateException, SAXException {
+
+        ClientResponse response = resource().queryParam("operation", "explain")
+                .get(ClientResponse.class);
+
+        InputStream entity = response.getEntity(InputStream.class);
+
+        assertEquals(200, response.getStatus());
+
+        Document doc = docBuilder.parse(entity);
+        NodeList nodelist = doc.getElementsByTagName("sruResponse:version");
+        assertEquals("2.0", nodelist.item(0).getTextContent());
+
+        nodelist = doc.getElementsByTagName("sruResponse:recordSchema");
+        assertEquals("http://explain.z3950.org/dtd/2.0/",
+                nodelist.item(0).getTextContent());
+
+        nodelist = doc.getElementsByTagName("zr:serverInfo");
+        NamedNodeMap attributes = nodelist.item(0).getAttributes();
+        assertEquals("SRU", attributes.getNamedItem("protocol").getNodeValue());
+        assertEquals("2.0", attributes.getNamedItem("version").getNodeValue());
+        assertEquals("http",
+                attributes.getNamedItem("transport").getNodeValue());
+
+        NodeList children = nodelist.item(0).getChildNodes();
+        assertEquals("zr:host", children.item(0).getNodeName());
+        assertEquals("127.0.0.1", children.item(0).getTextContent());
+        assertEquals("zr:port", children.item(1).getNodeName());
+        assertEquals("8080", children.item(1).getTextContent());
+        assertEquals("zr:database", children.item(2).getNodeName());
+        assertEquals("korapsru", children.item(2).getTextContent());
+
+        nodelist = doc.getElementsByTagName("zr:databaseInfo");
+        children = nodelist.item(0).getChildNodes();
+        assertEquals("zr:title", children.item(0).getNodeName());
+        assertEquals("KorAP", children.item(0).getTextContent());
+
+        nodelist = doc.getElementsByTagName("zr:indexInfo");
+        children = nodelist.item(0).getChildNodes();
+        assertEquals("zr:set", children.item(0).getNodeName());
+        assertEquals("http://clarin.eu/fcs/resource", children.item(0)
+                .getAttributes().getNamedItem("identifier").getNodeValue());
+        assertEquals("fcs", children.item(0).getAttributes()
+                .getNamedItem("name").getNodeValue());
+
+        nodelist = doc.getElementsByTagName("zr:schemaInfo");
+        children = nodelist.item(0).getChildNodes();
+        assertEquals("zr:schema", children.item(0).getNodeName());
+        assertEquals("http://clarin.eu/fcs/resource", children.item(0)
+                .getAttributes().getNamedItem("identifier").getNodeValue());
+        assertEquals("fcs", children.item(0).getAttributes()
+                .getNamedItem("name").getNodeValue());
+
+        nodelist = doc.getElementsByTagName("zr:configInfo");
+        children = nodelist.item(0).getChildNodes();
+        assertEquals("numberOfRecords", children.item(0).getAttributes()
+                .getNamedItem("type").getNodeValue());
+        assertEquals("25", children.item(0).getTextContent());
+        assertEquals("numberOfRecords", children.item(0).getAttributes()
+                .getNamedItem("type").getNodeValue());
+        assertEquals("50", children.item(1).getTextContent());
+
+        nodelist = doc.getElementsByTagName("ed:EndpointDescription");
+        assertEquals(0, nodelist.getLength());
+    }
+
+    @Test
+    public void explainEndpointDescriptionTest ()
+            throws URISyntaxException, ClientProtocolException, IOException,
+            IllegalStateException, SAXException {
+
+        String korapResources = IOUtils.toString(
                 ClassLoader.getSystemResourceAsStream(
                         "korap-api-responses/resources.json"),
                 StandardCharsets.UTF_8);
-        
+
         mockClient.reset()
-        .when(request().withMethod("GET").withPath("/resource"))
-        .respond(response()
-                .withHeader(new Header("Content-Type",
-                        "application/json; charset=utf-8"))
-                .withBody(korapResources).withStatusCode(200));
-        
-	    ClientResponse response = resource().queryParam("operation", "explain")
-	            .queryParam("x-fcs-endpoint-description", "true")
+                .when(request().withMethod("GET").withPath("/resource"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(korapResources).withStatusCode(200));
+
+        ClientResponse response = resource().queryParam("operation", "explain")
+                .queryParam("x-fcs-endpoint-description", "true")
                 .get(ClientResponse.class);
-        
+
         InputStream entity = response.getEntity(InputStream.class);
-        
-        assertEquals(200,response.getStatus());
-        
+
+        assertEquals(200, response.getStatus());
+
         Document doc = docBuilder.parse(entity);
-		NodeList nodelist = doc.getElementsByTagName("ed:EndpointDescription");
-		assertEquals("2", nodelist.item(0).getAttributes().getNamedItem("version").getNodeValue());
-		
-		nodelist = doc.getElementsByTagName("ed:Capabilities");
-		NodeList children = nodelist.item(0).getChildNodes();
-		assertEquals("http://clarin.eu/fcs/capability/basic-search", children.item(0).getTextContent());
-		assertEquals("http://clarin.eu/fcs/capability/advanced-search", children.item(1).getTextContent());
-		
-		nodelist = doc.getElementsByTagName("ed:SupportedDataViews");
-		children = nodelist.item(0).getChildNodes();
-		assertEquals("application/x-clarin-fcs-hits+xml", children.item(0).getTextContent());
-		assertEquals("send-by-default", children.item(0).getAttributes().getNamedItem("delivery-policy").getNodeValue());
-		assertEquals("application/x-clarin-fcs-adv+xml", children.item(1).getTextContent());
-		assertEquals("send-by-default", children.item(1).getAttributes().getNamedItem("delivery-policy").getNodeValue());
-		
-		nodelist = doc.getElementsByTagName("ed:SupportedLayers");
-		children = nodelist.item(0).getChildNodes();
-		assertEquals(6, children.getLength());
-		assertEquals("text", children.item(0).getTextContent());
-		assertEquals("http://clarin.ids-mannheim.de/korapsru/layers/text", children.item(0).getAttributes().getNamedItem("result-id").getNodeValue());
-		assertEquals("pos", children.item(1).getTextContent());
-		assertEquals("corenlp", children.item(1).getAttributes().getNamedItem("qualifier").getNodeValue());
-		
-		
-		nodelist = doc.getElementsByTagName("ed:Resource");
-		assertEquals(3, nodelist.getLength());
-		children = nodelist.item(0).getChildNodes();
-		assertEquals(7, children.getLength());
-		assertEquals("ed:Title", children.item(0).getNodeName());
-		assertEquals("ed:Description", children.item(2).getNodeName());
-		assertEquals("ed:LandingPageURI", children.item(3).getNodeName());
-		assertEquals("ed:Languages", children.item(4).getNodeName());
-		assertEquals("ed:AvailableDataViews", children.item(5).getNodeName());
-		assertEquals("ed:AvailableLayers", children.item(6).getNodeName());
-	}
-	
+        NodeList nodelist = doc.getElementsByTagName("ed:EndpointDescription");
+        assertEquals("2", nodelist.item(0).getAttributes()
+                .getNamedItem("version").getNodeValue());
+
+        nodelist = doc.getElementsByTagName("ed:Capabilities");
+        NodeList children = nodelist.item(0).getChildNodes();
+        assertEquals("http://clarin.eu/fcs/capability/basic-search",
+                children.item(0).getTextContent());
+        assertEquals("http://clarin.eu/fcs/capability/advanced-search",
+                children.item(1).getTextContent());
+
+        nodelist = doc.getElementsByTagName("ed:SupportedDataViews");
+        children = nodelist.item(0).getChildNodes();
+        assertEquals("application/x-clarin-fcs-hits+xml",
+                children.item(0).getTextContent());
+        assertEquals("send-by-default", children.item(0).getAttributes()
+                .getNamedItem("delivery-policy").getNodeValue());
+        assertEquals("application/x-clarin-fcs-adv+xml",
+                children.item(1).getTextContent());
+        assertEquals("send-by-default", children.item(1).getAttributes()
+                .getNamedItem("delivery-policy").getNodeValue());
+
+        nodelist = doc.getElementsByTagName("ed:SupportedLayers");
+        children = nodelist.item(0).getChildNodes();
+        assertEquals(6, children.getLength());
+        assertEquals("text", children.item(0).getTextContent());
+        assertEquals("http://clarin.ids-mannheim.de/korapsru/layers/text",
+                children.item(0).getAttributes().getNamedItem("result-id")
+                        .getNodeValue());
+        assertEquals("pos", children.item(1).getTextContent());
+        assertEquals("corenlp", children.item(1).getAttributes()
+                .getNamedItem("qualifier").getNodeValue());
+
+        nodelist = doc.getElementsByTagName("ed:Resource");
+        assertEquals(3, nodelist.getLength());
+        children = nodelist.item(0).getChildNodes();
+        assertEquals(7, children.getLength());
+        assertEquals("ed:Title", children.item(0).getNodeName());
+        assertEquals("ed:Description", children.item(2).getNodeName());
+        assertEquals("ed:LandingPageURI", children.item(3).getNodeName());
+        assertEquals("ed:Languages", children.item(4).getNodeName());
+        assertEquals("ed:AvailableDataViews", children.item(5).getNodeName());
+        assertEquals("ed:AvailableLayers", children.item(6).getNodeName());
+    }
+
 }
diff --git a/src/test/java/de/ids_mannheim/korap/test/RedirectTest.java b/src/test/java/de/ids_mannheim/korap/test/RedirectTest.java
index 8364bad..35df809 100644
--- a/src/test/java/de/ids_mannheim/korap/test/RedirectTest.java
+++ b/src/test/java/de/ids_mannheim/korap/test/RedirectTest.java
@@ -1,52 +1,74 @@
 package de.ids_mannheim.korap.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.mockserver.model.HttpOverrideForwardedRequest.forwardOverriddenRequest;
+import static org.mockserver.model.HttpRequest.request;
+import static org.mockserver.model.HttpResponse.response;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.http.HttpResponse;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.io.IOUtils;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.junit.Test;
+import org.mockserver.model.Header;
+import org.xml.sax.SAXException;
+
+import com.sun.jersey.api.client.ClientResponse;
 
 import de.ids_mannheim.korap.util.RedirectStrategy;
 
 /**
- * The test requires a running KustvaktServer.
- * Specify the Kustvakt service URI at
- * /KorapSRU/src/main/webapp/WEB-INF/web.xml
  * 
  * @author margaretha
  *
  */
-public class RedirectTest {
+public class RedirectTest extends BaseTest {
 
-//    private String korapAPI = "http://localhost:8089/api/";
-    private String korapAPI = "http://10.0.10.51:9000/api/";
-    
     @Test
-    public void testRedirect () throws ClientProtocolException, IOException {
-        HttpClient client = HttpClientBuilder.create()
-                .setRedirectStrategy(new RedirectStrategy()).build();
-        HttpResponse response = client.execute(new HttpGet(
-                korapAPI+"search?q=Wasser&ql=poliqarp"));
-        assertEquals(200, response.getStatusLine().getStatusCode());
-        
-        InputStream is = response.getEntity().getContent();
-        
-        BufferedReader br = new BufferedReader(new InputStreamReader(is));
-        String line = null;
-        String content = "";
-        while ((line = br.readLine())!=null){
-            content += line;
-        }
-        
-        assertTrue(!content.isEmpty());
+    public void testRedirect () throws ClientProtocolException, IOException,
+            SAXException, ParserConfigurationException {
+
+        String searchResult = IOUtils.toString(
+                ClassLoader.getSystemResourceAsStream(
+                        "korap-api-responses/search-lemma-fein.jsonld"),
+                StandardCharsets.UTF_8);
+
+        mockClient.reset()
+                .when(request().withMethod("GET").withPath("/search")
+                        .withQueryStringParameter("q", "[tt:lemma=\"fein\"]")
+                        .withQueryStringParameter("ql", "fcsql")
+                        .withQueryStringParameter("v", "2.0")
+                        .withQueryStringParameter("context", "sentence")
+                        .withQueryStringParameter("count", "1")
+                        .withQueryStringParameter("offset", "0"))
+                .forward(forwardOverriddenRequest(
+                        request().withPath("/redirect")));
+
+        mockClient
+                .when(request().withMethod("GET").withPath("/redirect")
+                        .withQueryStringParameter("q", "[tt:lemma=\"fein\"]")
+                        .withQueryStringParameter("ql", "fcsql")
+                        .withQueryStringParameter("v", "2.0")
+                        .withQueryStringParameter("context", "sentence")
+                        .withQueryStringParameter("count", "1")
+                        .withQueryStringParameter("offset", "0"))
+                .respond(response()
+                        .withHeader(new Header("Content-Type",
+                                "application/json; charset=utf-8"))
+                        .withBody(searchResult).withStatusCode(200));
+
+        ClientResponse response = resource()
+                .queryParam("operation", "searchRetrieve")
+                .queryParam("query", "[tt:lemma=\"fein\"]")
+                .queryParam("queryType", "fcs")
+                .queryParam("maximumRecords", "1").get(ClientResponse.class);
+
+        InputStream entity = response.getEntity(InputStream.class);
+        checkSRUSearchRetrieveResponse(entity);
     }
 }
diff --git a/src/test/resources/korap-api-responses/GOE-AGA-01784-p1856-1857.jsonld b/src/test/resources/korap-api-responses/GOE-AGA-01784-p1856-1857.jsonld
new file mode 100644
index 0000000..82d227e
--- /dev/null
+++ b/src/test/resources/korap-api-responses/GOE-AGA-01784-p1856-1857.jsonld
@@ -0,0 +1,26 @@
+{
+    "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+    "meta": {"version": "Krill-0.59.3"},
+    "snippet": "<span class=\"context-left\"><span class=\"more\"><\/span><\/span><span class=\"match\"><mark>Entwurf<\/mark><\/span><span class=\"context-right\"><span class=\"more\"><\/span><\/span>",
+    "matchID": "match-GOE/AGF/00000-p1856-1857",
+    "textSigle": "GOE/AGF/00000",
+    "subTitle": "Didaktischer Teil",
+    "author": "Goethe, Johann Wolfgang von",
+    "docSigle": "GOE/AGF",
+    "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",
+    "pubPlace": "München",
+    "availability": "CC-BY-SA",
+    "title": "Zur Farbenlehre",
+    "pubDate": "1982",
+    "corpusSigle": "GOE",
+    "context": {
+        "left": [
+            "token",
+            0
+        ],
+        "right": [
+            "token",
+            0
+        ]
+    }
+}
diff --git a/src/test/resources/korap-api-responses/GOE-AGF-00000-p15205-15206.jsonld b/src/test/resources/korap-api-responses/GOE-AGF-00000-p15205-15206.jsonld
new file mode 100644
index 0000000..bd9c3d2
--- /dev/null
+++ b/src/test/resources/korap-api-responses/GOE-AGF-00000-p15205-15206.jsonld
@@ -0,0 +1 @@
+{"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{"version":"Krill-0.59.3"},"snippet":"<span class=\"context-left\"></span><span class=\"match\"><span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:*\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:1\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:wir\"><span title=\"tt/p:PPER\">wir</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VMFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:1\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VMFIN\"><span title=\"opennlp/p:VVFIN\"><span title=\"tt/l:können\"><span title=\"tt/p:VMFIN\">können</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:also\"><span title=\"tt/p:ADV\">also</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">den</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:VVINF\"><span title=\"tt/l:untern\"><span title=\"tt/p:APPRART\">untern</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Teil\"><span title=\"tt/p:NN\">Teil</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">der</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Flamme\"><span title=\"tt/p:NN\">Flamme</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:für\"><span title=\"tt/p:APPR\">für</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:eine\"><span title=\"tt/p:ART\">einen</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Dunst\"><span title=\"tt/p:NN\">Dunst</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVINF\"><span title=\"marmot/p:VVINF\"><span title=\"opennlp/p:VVINF\"><span title=\"tt/l:ansprechen\"><span title=\"tt/p:VVFIN\"><span title=\"tt/p:VVINF\">ansprechen</span></span></span></span></span></span>, <span title=\"corenlp/p:PRELS\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PRELS\"><span title=\"opennlp/p:PWAT\"><span title=\"tt/l:welche\"><span title=\"tt/p:PWAT\"><span title=\"tt/p:PWS\">welcher</span></span></span></span></span></span></span></span></span>, <span title=\"corenlp/p:ADJD\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:obgleich\"><span title=\"tt/p:KOUS\">obgleich</span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:unendlich\"><span title=\"tt/p:ADJD\">unendlich</span></span></span></span></span></span> <mark><span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:fein\"><span title=\"tt/p:ADJD\"><span title=\"tt/p:PTKVZ\">fein</span></span></span></span></span></span></span></mark>, <span title=\"corenlp/p:KON\"><span title=\"marmot/p:KON\"><span title=\"opennlp/p:KON\"><span title=\"tt/l:doch\"><span title=\"tt/p:ADV\"><span title=\"tt/p:KON\">doch</span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:vor\"><span title=\"tt/p:APPR\">vor</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">der</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:ADJA\"><span title=\"tt/l:dunkel\"><span title=\"tt/p:ADJA\">dunklen</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Fläche\"><span title=\"tt/p:NN\">Fläche</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:sichtbar\"><span title=\"tt/p:ADJD\">sichtbar</span></span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:werden\"><span title=\"tt/p:VAFIN\">wird</span></span></span></span></span></span></span></span></span>: <span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:er\"><span title=\"tt/p:PPER\">er</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:sein\"><span title=\"tt/p:VAFIN\">ist</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:so\"><span title=\"tt/p:ADV\">so</span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:fein\"><span title=\"tt/p:ADJD\">fein</span></span></span></span></span></span>, <span title=\"corenlp/p:KOUS\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:KOUS\"><span title=\"tt/l:dass\"><span title=\"tt/p:KOUS\">daß</span></span></span></span></span> <span title=\"corenlp/p:PIS\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:*\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PIS\"><span title=\"opennlp/p:PIS\"><span title=\"tt/l:man\"><span title=\"tt/p:PIS\">man</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:bequem\"><span title=\"tt/p:ADJD\">bequem</span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:durch\"><span title=\"tt/p:APPR\">durch</span></span></span></span></span> <span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:er\"><span title=\"tt/p:PPER\">ihn</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVINF\"><span title=\"marmot/p:VVINF\"><span title=\"opennlp/p:VVINF\"><span title=\"tt/l:lesen\"><span title=\"tt/p:VVINF\">lesen</span></span></span></span></span> <span title=\"corenlp/p:VMFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VMFIN\"><span title=\"opennlp/p:VMFIN\"><span title=\"tt/l:können\"><span title=\"tt/p:VMFIN\">kann</span></span></span></span></span></span></span></span></span>; <span title=\"corenlp/p:VVIZU\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:PROAV\"><span title=\"tt/l:dahingegen\"><span title=\"tt/p:ADV\">dahingegen</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">die</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Spitze\"><span title=\"tt/p:NN\">Spitze</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">der</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Flamme\"><span title=\"tt/p:NN\">Flamme</span></span></span></span></span></span></span></span>, <span title=\"corenlp/p:PWAT\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:PRELS\"><span title=\"opennlp/p:PRELS\"><span title=\"tt/l:welche\"><span title=\"tt/p:PRELS\">welche</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:gender:*\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:1\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:wir\"><span title=\"tt/p:PPER\"><span title=\"tt/p:PRF\">uns</span></span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">die</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Gegenstand\"><span title=\"tt/p:NN\">Gegenstände</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVFIN\"><span title=\"marmot/p:VVPP\"><span title=\"opennlp/p:VVPP\"><span title=\"tt/l:verdecken\"><span title=\"tt/p:VVFIN\"><span title=\"tt/p:VVPP\">verdeckt</span></span></span></span></span></span>, <span title=\"corenlp/p:KOKOM\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:KOUS\"><span title=\"tt/l:als\"><span title=\"tt/p:KOKOM\"><span title=\"tt/p:KOUS\">als</span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:eine\"><span title=\"tt/p:ART\">ein</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:ADJA\"><span title=\"tt/l:selbstleuchtend\"><span title=\"tt/p:ADJA\">selbstleuchtender</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Körper\"><span title=\"tt/p:NN\">Körper</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVIZU\"><span title=\"marmot/p:VVIZU\"><span title=\"opennlp/p:VVIZU\"><span title=\"tt/l:ansehen\"><span title=\"tt/p:VVIZU\">anzusehen</span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:sein\"><span title=\"tt/p:VAFIN\">ist</span></span></span></span></span></span></span></span></span>.</span><span class=\"context-right\"></span>","matchID":"match-GOE/AGF/00000-p15205-15206","textSigle":"GOE/AGF/00000","subTitle":"Didaktischer Teil","author":"Goethe, Johann Wolfgang von","docSigle":"GOE/AGF","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","pubPlace":"München","availability":"CC-BY-SA","title":"Zur Farbenlehre","pubDate":"1982","corpusSigle":"GOE","context":{"left":["token",0],"right":["token",0]}}
diff --git a/src/test/resources/korap-api-responses/GOE-AGF-00000-p15216-15217.jsonld b/src/test/resources/korap-api-responses/GOE-AGF-00000-p15216-15217.jsonld
new file mode 100644
index 0000000..a6d1ce9
--- /dev/null
+++ b/src/test/resources/korap-api-responses/GOE-AGF-00000-p15216-15217.jsonld
@@ -0,0 +1 @@
+{"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{"version":"Krill-0.59.3"},"snippet":"<span class=\"context-left\"></span><span class=\"match\"><span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:*\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:1\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:wir\"><span title=\"tt/p:PPER\">wir</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VMFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:1\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VMFIN\"><span title=\"opennlp/p:VVFIN\"><span title=\"tt/l:können\"><span title=\"tt/p:VMFIN\">können</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:also\"><span title=\"tt/p:ADV\">also</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">den</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:VVINF\"><span title=\"tt/l:untern\"><span title=\"tt/p:APPRART\">untern</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Teil\"><span title=\"tt/p:NN\">Teil</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">der</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Flamme\"><span title=\"tt/p:NN\">Flamme</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:für\"><span title=\"tt/p:APPR\">für</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:eine\"><span title=\"tt/p:ART\">einen</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Dunst\"><span title=\"tt/p:NN\">Dunst</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVINF\"><span title=\"marmot/p:VVINF\"><span title=\"opennlp/p:VVINF\"><span title=\"tt/l:ansprechen\"><span title=\"tt/p:VVFIN\"><span title=\"tt/p:VVINF\">ansprechen</span></span></span></span></span></span>, <span title=\"corenlp/p:PRELS\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PRELS\"><span title=\"opennlp/p:PWAT\"><span title=\"tt/l:welche\"><span title=\"tt/p:PWAT\"><span title=\"tt/p:PWS\">welcher</span></span></span></span></span></span></span></span></span>, <span title=\"corenlp/p:ADJD\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:obgleich\"><span title=\"tt/p:KOUS\">obgleich</span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:unendlich\"><span title=\"tt/p:ADJD\">unendlich</span></span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:fein\"><span title=\"tt/p:ADJD\"><span title=\"tt/p:PTKVZ\">fein</span></span></span></span></span></span></span>, <span title=\"corenlp/p:KON\"><span title=\"marmot/p:KON\"><span title=\"opennlp/p:KON\"><span title=\"tt/l:doch\"><span title=\"tt/p:ADV\"><span title=\"tt/p:KON\">doch</span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:vor\"><span title=\"tt/p:APPR\">vor</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">der</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:ADJA\"><span title=\"tt/l:dunkel\"><span title=\"tt/p:ADJA\">dunklen</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Fläche\"><span title=\"tt/p:NN\">Fläche</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:sichtbar\"><span title=\"tt/p:ADJD\">sichtbar</span></span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:werden\"><span title=\"tt/p:VAFIN\">wird</span></span></span></span></span></span></span></span></span>: <span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:er\"><span title=\"tt/p:PPER\">er</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:sein\"><span title=\"tt/p:VAFIN\">ist</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:so\"><span title=\"tt/p:ADV\">so</span></span></span></span></span> <mark><span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:fein\"><span title=\"tt/p:ADJD\">fein</span></span></span></span></span></span></mark>, <span title=\"corenlp/p:KOUS\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:KOUS\"><span title=\"tt/l:dass\"><span title=\"tt/p:KOUS\">daß</span></span></span></span></span> <span title=\"corenlp/p:PIS\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:*\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PIS\"><span title=\"opennlp/p:PIS\"><span title=\"tt/l:man\"><span title=\"tt/p:PIS\">man</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:bequem\"><span title=\"tt/p:ADJD\">bequem</span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:durch\"><span title=\"tt/p:APPR\">durch</span></span></span></span></span> <span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:er\"><span title=\"tt/p:PPER\">ihn</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVINF\"><span title=\"marmot/p:VVINF\"><span title=\"opennlp/p:VVINF\"><span title=\"tt/l:lesen\"><span title=\"tt/p:VVINF\">lesen</span></span></span></span></span> <span title=\"corenlp/p:VMFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VMFIN\"><span title=\"opennlp/p:VMFIN\"><span title=\"tt/l:können\"><span title=\"tt/p:VMFIN\">kann</span></span></span></span></span></span></span></span></span>; <span title=\"corenlp/p:VVIZU\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:PROAV\"><span title=\"tt/l:dahingegen\"><span title=\"tt/p:ADV\">dahingegen</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">die</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Spitze\"><span title=\"tt/p:NN\">Spitze</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">der</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:gen\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Flamme\"><span title=\"tt/p:NN\">Flamme</span></span></span></span></span></span></span></span>, <span title=\"corenlp/p:PWAT\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:PRELS\"><span title=\"opennlp/p:PRELS\"><span title=\"tt/l:welche\"><span title=\"tt/p:PRELS\">welche</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:PPER\"><span title=\"marmot/m:case:dat\"><span title=\"marmot/m:gender:*\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:1\"><span title=\"marmot/p:PPER\"><span title=\"opennlp/p:PPER\"><span title=\"tt/l:wir\"><span title=\"tt/p:PPER\"><span title=\"tt/p:PRF\">uns</span></span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">die</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Gegenstand\"><span title=\"tt/p:NN\">Gegenstände</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVFIN\"><span title=\"marmot/p:VVPP\"><span title=\"opennlp/p:VVPP\"><span title=\"tt/l:verdecken\"><span title=\"tt/p:VVFIN\"><span title=\"tt/p:VVPP\">verdeckt</span></span></span></span></span></span>, <span title=\"corenlp/p:KOKOM\"><span title=\"marmot/p:KOUS\"><span title=\"opennlp/p:KOUS\"><span title=\"tt/l:als\"><span title=\"tt/p:KOKOM\"><span title=\"tt/p:KOUS\">als</span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:eine\"><span title=\"tt/p:ART\">ein</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:ADJA\"><span title=\"tt/l:selbstleuchtend\"><span title=\"tt/p:ADJA\">selbstleuchtender</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:masc\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Körper\"><span title=\"tt/p:NN\">Körper</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:VVIZU\"><span title=\"marmot/p:VVIZU\"><span title=\"opennlp/p:VVIZU\"><span title=\"tt/l:ansehen\"><span title=\"tt/p:VVIZU\">anzusehen</span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:sein\"><span title=\"tt/p:VAFIN\">ist</span></span></span></span></span></span></span></span></span>.</span><span class=\"context-right\"></span>","matchID":"match-GOE/AGF/00000-p15216-15217","textSigle":"GOE/AGF/00000","subTitle":"Didaktischer Teil","author":"Goethe, Johann Wolfgang von","docSigle":"GOE/AGF","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","pubPlace":"München","availability":"CC-BY-SA","title":"Zur Farbenlehre","pubDate":"1982","corpusSigle":"GOE","context":{"left":["token",0],"right":["token",0]}}
diff --git a/src/test/resources/korap-api-responses/GOE-AGF-00000-p4276-4277.jsonld b/src/test/resources/korap-api-responses/GOE-AGF-00000-p4276-4277.jsonld
new file mode 100644
index 0000000..5bb459d
--- /dev/null
+++ b/src/test/resources/korap-api-responses/GOE-AGF-00000-p4276-4277.jsonld
@@ -0,0 +1,26 @@
+{
+    "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+    "meta": {"version": "Krill-0.59.3"},
+    "snippet": "<span class=\"context-left\"><span class=\"more\"><\/span><\/span><span class=\"match\"><mark>feineren<\/mark><\/span><span class=\"context-right\"><span class=\"more\"><\/span><\/span>",
+    "matchID": "match-GOE/AGF/00000-p4276-4277",
+    "textSigle": "GOE/AGF/00000",
+    "subTitle": "Didaktischer Teil",
+    "author": "Goethe, Johann Wolfgang von",
+    "docSigle": "GOE/AGF",
+    "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",
+    "pubPlace": "München",
+    "availability": "CC-BY-SA",
+    "title": "Zur Farbenlehre",
+    "pubDate": "1982",
+    "corpusSigle": "GOE",
+    "context": {
+        "left": [
+            "token",
+            0
+        ],
+        "right": [
+            "token",
+            0
+        ]
+    }
+}
diff --git a/src/test/resources/korap-api-responses/GOE-AGF-00000-p45002-45003.jsonld b/src/test/resources/korap-api-responses/GOE-AGF-00000-p45002-45003.jsonld
new file mode 100644
index 0000000..e9562a0
--- /dev/null
+++ b/src/test/resources/korap-api-responses/GOE-AGF-00000-p45002-45003.jsonld
@@ -0,0 +1 @@
+{"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{"version":"Krill-0.59.3"},"snippet":"<span class=\"context-left\"></span><span class=\"match\"><span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:übrigens\"><span title=\"tt/p:ADV\">übrigens</span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:haben\"><span title=\"tt/p:VAFIN\">haben</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:PIAT\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:PIAT\"><span title=\"opennlp/p:PIAT\"><span title=\"tt/l:einige\"><span title=\"tt/p:PIAT\">einige</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:pl\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Pflanze|Pflanzen\"><span title=\"tt/p:NN\">Pflanzen</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:die\"><span title=\"tt/p:ART\">die</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Eigenschaft\"><span title=\"tt/p:NN\">Eigenschaft</span></span></span></span></span></span></span></span>, <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:durch\"><span title=\"tt/p:APPR\">durch</span></span></span></span></span> <span title=\"corenlp/p:ADJA\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ADJA\"><span title=\"opennlp/p:ADJA\"><span title=\"tt/l:künstlich\"><span title=\"tt/p:ADJA\">künstliche</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:fem\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/l:Behandlung\"><span title=\"tt/p:NN\">Behandlung</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:fast\"><span title=\"tt/p:ADV\">fast</span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:durchaus\"><span title=\"tt/p:ADV\">durchaus</span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:APPR\"><span title=\"opennlp/p:APPR\"><span title=\"tt/l:in\"><span title=\"tt/p:APPR\">in</span></span></span></span></span> <span title=\"corenlp/p:ART\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:neut\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:ART\"><span title=\"opennlp/p:ART\"><span title=\"tt/l:eine\"><span title=\"tt/p:ART\">ein</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:NN\"><span title=\"marmot/m:case:acc\"><span title=\"marmot/m:gender:neut\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:NN\"><span title=\"opennlp/p:NN\"><span title=\"tt/p:NN\">Farbenmaterial</span></span></span></span></span></span></span> <span title=\"corenlp/p:VVPP\"><span title=\"marmot/p:VVPP\"><span title=\"opennlp/p:VVPP\"><span title=\"tt/l:verwandeln\"><span title=\"tt/l:verwandelt\"><span title=\"tt/p:ADJD\"><span title=\"tt/p:VVPP\">verwandelt</span></span></span></span></span></span></span> <span title=\"corenlp/p:PTKZU\"><span title=\"marmot/p:PTKZU\"><span title=\"opennlp/p:PTKZU\"><span title=\"tt/l:zu\"><span title=\"tt/p:PTKZU\">zu</span></span></span></span></span> <span title=\"corenlp/p:VAINF\"><span title=\"marmot/p:VAINF\"><span title=\"opennlp/p:VAINF\"><span title=\"tt/l:werden\"><span title=\"tt/p:VAINF\">werden</span></span></span></span></span>, <span title=\"corenlp/p:PRELS\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:neut\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PRELS\"><span title=\"opennlp/p:PRELS\"><span title=\"tt/l:die\"><span title=\"tt/p:PDS\"><span title=\"tt/p:PRELS\">das</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:ADV\"><span title=\"marmot/p:ADV\"><span title=\"opennlp/p:ADV\"><span title=\"tt/l:so\"><span title=\"tt/p:ADV\">so</span></span></span></span></span> <mark><span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:fein\"><span title=\"tt/p:ADJD\">fein</span></span></span></span></span></span></mark>, <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:wirksam\"><span title=\"tt/p:ADJD\">wirksam</span></span></span></span></span></span> <span title=\"corenlp/p:KON\"><span title=\"marmot/p:KON\"><span title=\"opennlp/p:KON\"><span title=\"tt/l:und\"><span title=\"tt/p:KON\">und</span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:unendlich\"><span title=\"tt/p:ADJD\">unendlich</span></span></span></span></span></span> <span title=\"corenlp/p:ADJD\"><span title=\"marmot/m:degree:pos\"><span title=\"marmot/p:ADJD\"><span title=\"opennlp/p:ADJD\"><span title=\"tt/l:teilbar\"><span title=\"tt/p:ADJD\">teilbar</span></span></span></span></span></span> <span title=\"corenlp/p:VAFIN\"><span title=\"marmot/m:mood:ind\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/m:person:3\"><span title=\"marmot/m:tense:pres\"><span title=\"marmot/p:VAFIN\"><span title=\"opennlp/p:VAFIN\"><span title=\"tt/l:sein\"><span title=\"tt/p:VAFIN\">ist</span></span></span></span></span></span></span></span></span> <span title=\"corenlp/p:APPR\"><span title=\"marmot/p:KOKOM\"><span title=\"opennlp/p:KOKOM\"><span title=\"tt/l:als\"><span title=\"tt/p:KOKOM\">als</span></span></span></span></span> <span title=\"corenlp/p:PIAT\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:neut\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PIAT\"><span title=\"opennlp/p:PIAT\"><span title=\"tt/l:irgendeine\"><span title=\"tt/p:PIAT\">irgendein</span></span></span></span></span></span></span></span> <span title=\"corenlp/p:PIS\"><span title=\"marmot/m:case:nom\"><span title=\"marmot/m:gender:neut\"><span title=\"marmot/m:number:sg\"><span title=\"marmot/p:PIS\"><span title=\"opennlp/p:PIS\"><span title=\"tt/l:andere\"><span title=\"tt/p:PIS\">anderes</span></span></span></span></span></span></span></span>.</span><span class=\"context-right\"></span>","matchID":"match-GOE/AGF/00000-p45002-45003","textSigle":"GOE/AGF/00000","subTitle":"Didaktischer Teil","author":"Goethe, Johann Wolfgang von","docSigle":"GOE/AGF","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","pubPlace":"München","availability":"CC-BY-SA","title":"Zur Farbenlehre","pubDate":"1982","corpusSigle":"GOE","context":{"left":["token",0],"right":["token",0]}}
diff --git a/src/test/resources/korap-api-responses/search-der.jsonld b/src/test/resources/korap-api-responses/search-der.jsonld
new file mode 100644
index 0000000..f834a3a
--- /dev/null
+++ b/src/test/resources/korap-api-responses/search-der.jsonld
@@ -0,0 +1,79 @@
+{
+    "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+    "meta": {
+        "count": 1,
+        "startIndex": 50,
+        "timeout": 10000,
+        "context": "base/s:s",
+        "fields": [
+            "ID",
+            "UID",
+            "textSigle",
+            "corpusID",
+            "author",
+            "title",
+            "subTitle",
+            "textClass",
+            "pubPlace",
+            "pubDate",
+            "availability",
+            "layerInfos",
+            "docSigle",
+            "corpusSigle"
+        ],
+        "version": "0.59.3",
+        "benchmark": "2.8924209999999997 ms",
+        "totalResults": 1858,
+        "serialQuery": "tokens:s:der",
+        "itemsPerPage": 1
+    },
+    "query": {
+        "@type": "koral:token",
+        "wrap": {
+            "@type": "koral:term",
+            "key": "der",
+            "layer": "orth",
+            "match": "match:eq",
+            "foundry": "opennlp",
+            "rewrites": [
+                {
+                    "@type": "koral:rewrite",
+                    "src": "Kustvakt",
+                    "operation": "operation:injection",
+                    "scope": "foundry"
+                }
+            ]
+        }
+    },
+    "collection": {
+        "@type": "koral:doc",
+        "match": "match:eq",
+        "type": "type:regex",
+        "value": "CC-BY.*",
+        "key": "availability",
+        "rewrites": [
+            {
+                "@type": "koral:rewrite",
+                "src": "Kustvakt",
+                "operation": "operation:insertion",
+                "scope": "availability(FREE)"
+            }
+        ]
+    },
+    "matches": [
+        {
+            "snippet": "<span class=\"context-left\"><\/span><span class=\"match\"><mark>der<\/mark><\/span><span class=\"context-right\"> Verlust der Preußen an Toten und Blessierten mag 90 Mann sein.<\/span>",
+            "matchID": "match-GOE/AGA/01784-p1856-1857",
+            "UID": 0,
+            "textSigle": "GOE/AGA/01784",
+            "author": "Goethe, Johann Wolfgang von",
+            "docSigle": "GOE/AGA",
+            "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",
+            "pubPlace": "München",
+            "availability": "CC-BY-SA",
+            "title": "Belagerung von Mainz",
+            "pubDate": "1982",
+            "corpusSigle": "GOE"
+        }
+    ]
+}
diff --git a/src/test/resources/korap-api-responses/search-fein.jsonld b/src/test/resources/korap-api-responses/search-fein.jsonld
new file mode 100644
index 0000000..7f9070d
--- /dev/null
+++ b/src/test/resources/korap-api-responses/search-fein.jsonld
@@ -0,0 +1,110 @@
+{
+    "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+    "meta": {
+        "count": 25,
+        "startIndex": 0,
+        "timeout": 10000,
+        "context": "base/s:s",
+        "fields": [
+            "ID",
+            "UID",
+            "textSigle",
+            "corpusID",
+            "author",
+            "title",
+            "subTitle",
+            "textClass",
+            "pubPlace",
+            "pubDate",
+            "availability",
+            "layerInfos",
+            "docSigle",
+            "corpusSigle"
+        ],
+        "version": "0.59.3",
+        "benchmark": "0.157236466 s",
+        "totalResults": 3,
+        "serialQuery": "tokens:s:fein",
+        "itemsPerPage": 25
+    },
+    "query": {
+        "@type": "koral:token",
+        "wrap": {
+            "@type": "koral:term",
+            "key": "fein",
+            "layer": "orth",
+            "match": "match:eq",
+            "foundry": "opennlp",
+            "rewrites": [
+                {
+                    "@type": "koral:rewrite",
+                    "src": "Kustvakt",
+                    "operation": "operation:injection",
+                    "scope": "foundry"
+                }
+            ]
+        }
+    },
+    "collection": {
+        "@type": "koral:doc",
+        "match": "match:eq",
+        "type": "type:regex",
+        "value": "CC-BY.*",
+        "key": "availability",
+        "rewrites": [
+            {
+                "@type": "koral:rewrite",
+                "src": "Kustvakt",
+                "operation": "operation:insertion",
+                "scope": "availability(FREE)"
+            }
+        ]
+    },
+    "matches": [
+        {
+            "snippet": "<span class=\"context-left\">wir können also den untern Teil der Flamme für einen Dunst ansprechen, welcher, obgleich unendlich <\/span><span class=\"match\"><mark>fein<\/mark><\/span><span class=\"context-right\">, doch vor der dunklen Fläche sichtbar wird: er ist so fein, daß man bequem durch ihn lesen kann; dahingegen die Spitze der Flamme, welche uns die Gegenstände verdeckt, als ein selbstleuchtender Körper anzusehen ist.<\/span>",
+            "matchID": "match-GOE/AGF/00000-p15205-15206",
+            "UID": 0,
+            "textSigle": "GOE/AGF/00000",
+            "subTitle": "Didaktischer Teil",
+            "author": "Goethe, Johann Wolfgang von",
+            "docSigle": "GOE/AGF",
+            "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",
+            "pubPlace": "München",
+            "availability": "CC-BY-SA",
+            "title": "Zur Farbenlehre",
+            "pubDate": "1982",
+            "corpusSigle": "GOE"
+        },
+        {
+            "snippet": "<span class=\"context-left\">wir können also den untern Teil der Flamme für einen Dunst ansprechen, welcher, obgleich unendlich fein, doch vor der dunklen Fläche sichtbar wird: er ist so <\/span><span class=\"match\"><mark>fein<\/mark><\/span><span class=\"context-right\">, daß man bequem durch ihn lesen kann; dahingegen die Spitze der Flamme, welche uns die Gegenstände verdeckt, als ein selbstleuchtender Körper anzusehen ist.<\/span>",
+            "matchID": "match-GOE/AGF/00000-p15216-15217",
+            "UID": 0,
+            "textSigle": "GOE/AGF/00000",
+            "subTitle": "Didaktischer Teil",
+            "author": "Goethe, Johann Wolfgang von",
+            "docSigle": "GOE/AGF",
+            "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",
+            "pubPlace": "München",
+            "availability": "CC-BY-SA",
+            "title": "Zur Farbenlehre",
+            "pubDate": "1982",
+            "corpusSigle": "GOE"
+        },
+        {
+            "snippet": "<span class=\"context-left\">übrigens haben einige Pflanzen die Eigenschaft, durch künstliche Behandlung fast durchaus in ein Farbenmaterial verwandelt zu werden, das so <\/span><span class=\"match\"><mark>fein<\/mark><\/span><span class=\"context-right\">, wirksam und unendlich teilbar ist als irgendein anderes.<\/span>",
+            "matchID": "match-GOE/AGF/00000-p45002-45003",
+            "UID": 0,
+            "textSigle": "GOE/AGF/00000",
+            "subTitle": "Didaktischer Teil",
+            "author": "Goethe, Johann Wolfgang von",
+            "docSigle": "GOE/AGF",
+            "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",
+            "pubPlace": "München",
+            "availability": "CC-BY-SA",
+            "title": "Zur Farbenlehre",
+            "pubDate": "1982",
+            "corpusSigle": "GOE"
+        }
+    ]
+}
diff --git a/src/test/resources/korap-api-responses/search-lemma-fein.jsonld b/src/test/resources/korap-api-responses/search-lemma-fein.jsonld
new file mode 100644
index 0000000..b9f7166
--- /dev/null
+++ b/src/test/resources/korap-api-responses/search-lemma-fein.jsonld
@@ -0,0 +1,73 @@
+{
+    "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+    "meta": {
+        "count": 1,
+        "startIndex": 0,
+        "timeout": 10000,
+        "context": "base/s:s",
+        "fields": [
+            "ID",
+            "UID",
+            "textSigle",
+            "corpusID",
+            "author",
+            "title",
+            "subTitle",
+            "textClass",
+            "pubPlace",
+            "pubDate",
+            "availability",
+            "layerInfos",
+            "docSigle",
+            "corpusSigle"
+        ],
+        "version": "0.59.3",
+        "benchmark": "10.240179 ms",
+        "totalResults": 14,
+        "serialQuery": "SpanMultiTermQueryWrapper(tokens:/tt/l:fein/)",
+        "itemsPerPage": 1
+    },
+    "query": {
+        "@type": "koral:token",
+        "wrap": {
+            "@type": "koral:term",
+            "key": "fein",
+            "foundry": "tt",
+            "layer": "l",
+            "type": "type:regex",
+            "match": "match:eq"
+        }
+    },
+    "collection": {
+        "@type": "koral:doc",
+        "match": "match:eq",
+        "type": "type:regex",
+        "value": "CC-BY.*",
+        "key": "availability",
+        "rewrites": [
+            {
+                "@type": "koral:rewrite",
+                "src": "Kustvakt",
+                "operation": "operation:insertion",
+                "scope": "availability(FREE)"
+            }
+        ]
+    },
+    "matches": [
+        {
+            "snippet": "<span class=\"context-left\">der Chemiker, welcher auf die Farben als Kriterien achtet, um die geheimern Eigenschaften körperlicher Wesen zu entdecken, hat bisher bei Benennung und Bezeichnung der Farben manches Hindernis gefunden; ja man ist nach einer näheren und <\/span><span class=\"match\"><mark>feineren<\/mark><\/span><span class=\"context-right\"> Betrachtung bewogen worden, die Farbe als ein unsicheres und trügliches Kennzeichen bei chemischen Operationen anzusehen.<\/span>",
+            "matchID": "match-GOE/AGF/00000-p4276-4277",
+            "UID": 0,
+            "textSigle": "GOE/AGF/00000",
+            "subTitle": "Didaktischer Teil",
+            "author": "Goethe, Johann Wolfgang von",
+            "docSigle": "GOE/AGF",
+            "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",
+            "pubPlace": "München",
+            "availability": "CC-BY-SA",
+            "title": "Zur Farbenlehre",
+            "pubDate": "1982",
+            "corpusSigle": "GOE"
+        }
+    ]
+}