Added supported layers in the endpoint description.

Change-Id: I3cde116b5c21003a91d3bb14f0e10dd8a87a252d
diff --git a/pom.xml b/pom.xml
index 5054017..a075c99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,6 +72,7 @@
   <repositories>
     <repository>
       <id>CLARIN</id>
+      <name>CLARIN Repository</name>
       <url>https://nexus.clarin.eu/content/repositories/Clarin</url>
       <!-- <url>http://catalog.clarin.eu/ds/nexus/content/repositories/Clarin/</url> -->
       <layout>default</layout>
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java b/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
index 0776c56..fff2e5d 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
@@ -29,7 +29,6 @@
 public class KorapClient {
 	
 	private static final String SERVICE_URI = "http://10.0.10.13:7070/api/v0.1/";
-	private String QUERY_LANGUAGE = "CQL";
 	private String CONTEXT_TYPE = "sentence";
 	
 	private int defaultNumOfRecords = 10;
@@ -87,9 +86,9 @@
 	}
 	
 	
-	public KorapResult query(String query, String version, int startRecord, 
-			int maximumRecords, String[] corpora) throws HttpResponseException,
-			IOException {
+	public KorapResult query(String query, QueryLanguage queryLanguage,
+			String version, int startRecord, int maximumRecords,
+			String[] corpora) throws HttpResponseException, IOException {
 		
 		checkQuery(query, startRecord, maximumRecords);
 		
@@ -118,7 +117,8 @@
 		else {*/
 		
 			try {
-				httpRequest = createRequest(query, version, startRecord-1, 
+			httpRequest = createRequest(query, queryLanguage, version,
+					startRecord - 1,
 						maximumRecords);
 			} catch (URISyntaxException e) {
 				throw new IOException("Failed creating http request.");
@@ -163,15 +163,26 @@
 			throws IOException{
 		InputStream is = response.getEntity().getContent(); 
 		JsonNode node = objectMapper.readTree(is);
-		String message = node.get("error").textValue();						
-		String[] errorItems = message.split(":",2);
-		errorItems[0] = errorItems[0].replace("SRU diagnostic ", "");
-		errorItems[1] = errorItems[1].trim();
+		String message = node.get("error").textValue();
+		String[] errorItems;
+		if (message.contains("SRU diagnostic")) {
+			errorItems = message.split(":", 2);
+			errorItems[0] = errorItems[0].replace("SRU diagnostic ", "");
+			errorItems[1] = errorItems[1].trim();
+		}
+		else if (message.contains("not a supported query language")){
+			errorItems = new String[]{"4",
+					"KorAP does not support the query language."};
+		}
+		else {
+			errorItems = new String[]{"1", message};
+		}
+		
 		return errorItems;						
 	}
 	
-	private HttpGet createRequest(String query, String version, int startRecord, 
-			int maximumRecords) 
+	private HttpGet createRequest(String query, QueryLanguage queryLanguage,
+			String version, int startRecord, int maximumRecords)
 			throws URISyntaxException {
 
 		if (maximumRecords <= 0) {
@@ -184,7 +195,7 @@
 		
 		List<NameValuePair> params = new ArrayList<NameValuePair>(); 
 		params.add(new BasicNameValuePair("q", query));
-		params.add(new BasicNameValuePair("ql", QUERY_LANGUAGE));
+		params.add(new BasicNameValuePair("ql", queryLanguage.toString()));
 		params.add(new BasicNameValuePair("v", version));
 		params.add(new BasicNameValuePair("context", CONTEXT_TYPE));
 		params.add(new BasicNameValuePair("count", String.valueOf(maximumRecords)));
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java b/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
index 6762b63..76a36f6 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
@@ -1,13 +1,17 @@
 package de.mannheim.ids.korap.sru;
 
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.ServletContext;
+
 import com.fasterxml.jackson.databind.JsonNode;
 
 import eu.clarin.sru.server.SRUConfigException;
@@ -15,6 +19,7 @@
 import eu.clarin.sru.server.SRUException;
 import eu.clarin.sru.server.fcs.DataView;
 import eu.clarin.sru.server.fcs.DataView.DeliveryPolicy;
+import eu.clarin.sru.server.fcs.utils.SimpleEndpointDescriptionParser;
 import eu.clarin.sru.server.fcs.EndpointDescription;
 import eu.clarin.sru.server.fcs.Layer;
 import eu.clarin.sru.server.fcs.ResourceInfo;
@@ -26,24 +31,27 @@
 	private List<String> languages;
 	
 	private String defaultDataview = "hits";
+	private List<Layer> layers;
 
-	public KorapEndpointDescription() throws SRUConfigException {
-		dataviews = new ArrayList<DataView>();
-		dataviews.add(new DataView("hits", "application/x-clarin-fcs-hits+xml",
-				DeliveryPolicy.SEND_BY_DEFAULT));
-		dataviews.add(new DataView("kwic", "application/x-clarin-fcs-kwic+xml",
-				DeliveryPolicy.NEED_TO_REQUEST));
-
-		capabilities = new ArrayList<URI>();
+	public KorapEndpointDescription(ServletContext context)
+			throws SRUConfigException {
 		try {
-			capabilities.add(new URI(
-					"http://clarin.eu/fcs/capability/basic-search"));
-		} catch (URISyntaxException e) {
-			throw new SRUConfigException("Found an invalid capability URI.");
-		}
+			URL url = context.getResource("/WEB-INF/endpoint-description.xml");
+			EndpointDescription simpleEndpointDescription = SimpleEndpointDescriptionParser
+					.parse(url);
+			if (simpleEndpointDescription != null) {
+				setSupportedLayers(simpleEndpointDescription
+						.getSupportedLayers());
+				setSupportedDataViews(simpleEndpointDescription
+						.getSupportedDataViews());
+				setCapabilities(simpleEndpointDescription.getCapabilities());
+			}
 
-		languages = new ArrayList<String>();
-		languages.add("deu");
+		} catch (MalformedURLException e) {
+			throw new SRUConfigException(
+					"error initializing resource info inventory", e);
+		}
+		setLanguages();
 	}
 
 	@Override
@@ -53,16 +61,44 @@
 		languages.clear();
 	}
 
+	public void setLanguages() {
+		languages = new ArrayList<String>();
+		languages.add("deu");
+	}
+
 	@Override
 	public List<URI> getCapabilities() {
 		return capabilities;
 	}
 
+	public void setCapabilities(List<URI> list) throws SRUConfigException {
+		capabilities = list;
+//		new ArrayList<URI>();
+//		try {
+//			capabilities.add(new URI(
+//					"http://clarin.eu/fcs/capability/basic-search"));
+//		} catch (URISyntaxException e) {
+//			throw new SRUConfigException("Found an invalid capability URI.");
+//		}
+	}
+
 	@Override
 	public List<DataView> getSupportedDataViews() {
 		return dataviews;
 	}
 
+	public void setSupportedDataViews(List<DataView> list) {
+		dataviews = list;
+
+		// new ArrayList<DataView>();
+		// dataviews.add(new DataView("hits",
+		// "application/x-clarin-fcs-hits+xml",
+		// DeliveryPolicy.SEND_BY_DEFAULT));
+		// dataviews.add(new DataView("kwic",
+		// "application/x-clarin-fcs-kwic+xml",
+		// DeliveryPolicy.NEED_TO_REQUEST));
+	}
+
 	@Override
 	public List<ResourceInfo> getResourceList(String pid) throws SRUException {
 
@@ -105,9 +141,13 @@
 		this.defaultDataview = defaultDataview;
 	}
 
+	public void setSupportedLayers(List<Layer> list) {
+		this.layers = list;
+	}
+
 	@Override
 	public List<Layer> getSupportedLayers() {
-		return null;
+		return layers;
 	}
 
 }
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
index 80e01af..f57f6f9 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
@@ -8,9 +8,7 @@
 import org.apache.http.client.HttpResponseException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.z3950.zing.cql.CQLNode;
 
-import eu.clarin.sru.server.CQLQueryParser;
 import eu.clarin.sru.server.SRUConfigException;
 import eu.clarin.sru.server.SRUConstants;
 import eu.clarin.sru.server.SRUDiagnosticList;
@@ -19,7 +17,6 @@
 import eu.clarin.sru.server.SRURequest;
 import eu.clarin.sru.server.SRUSearchResultSet;
 import eu.clarin.sru.server.SRUServerConfig;
-import eu.clarin.sru.server.SRUVersion;
 import eu.clarin.sru.server.fcs.Constants;
 import eu.clarin.sru.server.fcs.DataView;
 import eu.clarin.sru.server.fcs.EndpointDescription;
@@ -28,55 +25,59 @@
 /**
  * @author margaretha
  * */
-public class KorapSRU extends SimpleEndpointSearchEngineBase{
+public class KorapSRU extends SimpleEndpointSearchEngineBase {
 
-	public static final String CLARIN_FCS_RECORD_SCHEMA =
-            "http://clarin.eu/fcs/resource";
-	public static final String KORAP_WEB_URL = 
-			"http://korap.ids-mannheim.de/kalamar";
-	
+	public static final String CLARIN_FCS_RECORD_SCHEMA = "http://clarin.eu/fcs/resource";
+	public static final String KORAP_WEB_URL = "http://korap.ids-mannheim.de/kalamar";
+
+	public static String redirectBaseURI;
 	public static KorapClient korapClient;
 	private KorapEndpointDescription korapEndpointDescription;
 	private SRUServerConfig serverConfig;
 
-	public static String redirectBaseURI;
-	
-	private Logger logger = (Logger) LoggerFactory.getLogger(KorapSRU.class);	
+	private Logger logger = (Logger) LoggerFactory.getLogger(KorapSRU.class);
 
 	@Override
 	protected EndpointDescription createEndpointDescription(
 			ServletContext context, SRUServerConfig config,
 			Map<String, String> params) throws SRUConfigException {
-		korapEndpointDescription = new KorapEndpointDescription();
+		korapEndpointDescription = new KorapEndpointDescription(context);
 		return korapEndpointDescription;
 	}
-	
+
 	@Override
 	protected void doInit(ServletContext context, SRUServerConfig config,
 			SRUQueryParserRegistry.Builder parserRegistryBuilder,
-			Map<String, String> params)
-			throws SRUConfigException {
+			Map<String, String> params) throws SRUConfigException {
 		serverConfig = config;
-		korapClient = new KorapClient(config.getNumberOfRecords(), 
+		korapClient = new KorapClient(config.getNumberOfRecords(),
 				config.getMaximumRecords());
-		
+
 		StringBuilder sb = new StringBuilder();
 		sb.append(config.getTransports());
 		sb.append("://");
-        sb.append(config.getHost());
-        if (config.getPort() != 80) {
-            sb.append(":").append(config.getPort());
-        }
-        sb.append("/").append(config.getDatabase());
-        sb.append("/").append("redirect/");
-        this.redirectBaseURI = sb.toString();
+		sb.append(config.getHost());
+		if (config.getPort() != 80) {
+			sb.append(":").append(config.getPort());
+		}
+		sb.append("/").append(config.getDatabase());
+		sb.append("/").append("redirect/");
+		this.redirectBaseURI = sb.toString();
+
+		// queryParser = new ThreadLocal<QueryParser>() {
+		// @Override
+		// protected QueryParser initialValue() {
+		// return new QueryParser("text", new StandardAnalyzer(
+		// CharArraySet.EMPTY_SET));
+		// }
+		// };
 	}
 
 	@Override
 	public SRUSearchResultSet search(SRUServerConfig config,
 			SRURequest request, SRUDiagnosticList diagnostics)
 			throws SRUException {
-				
+
 		checkRequestRecordSchema(request);
 
 		String dataview = korapEndpointDescription.getDefaultDataView();
@@ -85,107 +86,111 @@
 					request.getExtraRequestData("x-fcs-dataviews"), diagnostics);
 		}
 
-		if (!request.isQueryType(Constants.FCS_QUERY_TYPE_CQL)) {
+		String queryType = request.getQueryType();
+		logger.info("Query language: " + queryType);
+		QueryLanguage queryLanguage;
+		if (request.isQueryType(Constants.FCS_QUERY_TYPE_CQL)) {
+			queryLanguage = QueryLanguage.CQL;
+		} else if (request.isQueryType(Constants.FCS_QUERY_TYPE_FCS)) {
+			queryLanguage = QueryLanguage.FCSQL;
+		} else {
 			throw new SRUException(
 					SRUConstants.SRU_CANNOT_PROCESS_QUERY_REASON_UNKNOWN,
 					"Queries with queryType '"
 							+ request.getQueryType()
 							+ "' are not supported by this CLARIN-FCS Endpoint.");
 		}
-		CQLQueryParser.CQLQuery cqlQuery = request
-				.getQuery(CQLQueryParser.CQLQuery.class);
-		
-		String korapQuery = translateCQLtoKorapQuery(cqlQuery.getParsedQuery());
-        String version = null;
-        if (request.isVersion(SRUVersion.VERSION_1_1)){
-        	 version = "1.1";
-        }
-        else if (request.isVersion(SRUVersion.VERSION_1_2)){
-        	version = "1.2";
-        }
-        else {
-        	serverConfig.getDefaultVersion();
-        }
+		logger.info("Query language: " + queryLanguage);
+
+		String queryStr = null;
+		queryStr = request.getQuery().getRawQuery();
+		if ((queryStr == null) || queryStr.isEmpty()) {
+			throw new SRUException(SRUConstants.SRU_EMPTY_TERM_UNSUPPORTED,
+					"An empty term is not supported.");
+		}
+		logger.info("korapsru query: " + queryStr);
+
+		String version = null;
+		switch (request.getVersion()) {
+			case VERSION_1_1 :
+				version = "1.1";
+			case VERSION_1_2 :
+				version = "1.2";
+			case VERSION_2_0 :
+				version = "2.0";
+			default :
+				serverConfig.getDefaultVersion();
+		}
 
 		KorapResult korapResult = new KorapResult();
 		try {
-			korapResult = korapClient.query(
-					korapQuery,
-					version,
-					request.getStartRecord(), 
-					request.getMaximumRecords(),
-					getCorporaList(request)
-			);
-		}
-		catch (HttpResponseException e) {
-			logger.warn("HttpResponseException: " +e.getStatusCode()+" "+e.getMessage());
+			korapResult = korapClient.query(queryStr, queryLanguage, version,
+					request.getStartRecord(), request.getMaximumRecords(),
+					getCorporaList(request));
+		} catch (HttpResponseException e) {
+			logger.warn("HttpResponseException: " + e.getStatusCode() + " "
+					+ e.getMessage());
 			switch (e.getStatusCode()) {
-			case 16:
-				throw new SRUException(SRUConstants.SRU_UNSUPPORTED_INDEX, 
-						e.getMessage());
-			case 19:
-				throw new SRUException(SRUConstants.SRU_UNSUPPORTED_RELATION, 
-						e.getMessage());	
-			case 20: 
-				throw new SRUException(SRUConstants.SRU_UNSUPPORTED_RELATION_MODIFIER,
-						e.getMessage());			
-			case 27: 
-				throw new SRUException(SRUConstants.SRU_EMPTY_TERM_UNSUPPORTED,
-						e.getMessage());
-			case 48 :
-				throw new SRUException(SRUConstants.SRU_QUERY_FEATURE_UNSUPPORTED, 
-						e.getMessage());
-			default: 
+				case 16 :
+					throw new SRUException(SRUConstants.SRU_UNSUPPORTED_INDEX,
+							e.getMessage());
+				case 19 :
+					throw new SRUException(
+							SRUConstants.SRU_UNSUPPORTED_RELATION,
+							e.getMessage());
+				case 20 :
+					throw new SRUException(
+							SRUConstants.SRU_UNSUPPORTED_RELATION_MODIFIER,
+							e.getMessage());
+				case 27 :
+					throw new SRUException(
+							SRUConstants.SRU_EMPTY_TERM_UNSUPPORTED,
+							e.getMessage());
+				case 48 :
+					throw new SRUException(
+							SRUConstants.SRU_QUERY_FEATURE_UNSUPPORTED,
+							e.getMessage());
+				default :
 					throw new SRUException(
 							SRUConstants.SRU_GENERAL_SYSTEM_ERROR,
 							e.getMessage());
 			}
-			
-		}
-		catch (IOException e) {
+
+		} catch (IOException e) {
 			throw new SRUException(SRUConstants.SRU_GENERAL_SYSTEM_ERROR,
 					e.getMessage());
-		}		
-		
+		}
+
 		return new KorapSRUSearchResultSet(diagnostics, korapResult, dataview);
 	}
-	
-	private String[] getCorporaList(SRURequest request){
-		try { 
+
+	private String[] getCorporaList(SRURequest request) {
+		try {
 			String corpusPids = request.getExtraRequestData("x-fcs-context");
-			if (!corpusPids.isEmpty() && corpusPids != null){
-				if (corpusPids.contains(",")){
+			if (!corpusPids.isEmpty() && corpusPids != null) {
+				if (corpusPids.contains(",")) {
 					return corpusPids.split(",");
 				}
 				return new String[]{corpusPids};
 			}
 			return null;
-		}
-		catch (NullPointerException e) {
+		} catch (NullPointerException e) {
 			return null;
 		}
 	}
-	
-	private String translateCQLtoKorapQuery(CQLNode query) throws SRUException {
-		String queryStr = query.toString();
-		if ((queryStr == null) || queryStr.isEmpty()) {
-            throw new SRUException(SRUConstants.SRU_EMPTY_TERM_UNSUPPORTED,
-                    "An empty term is not supported.");
-        }
-		return queryStr;
-	}
-	
-	private void checkRequestRecordSchema(SRURequest request) throws SRUException{
-		final String recordSchemaIdentifier =
-	            request.getRecordSchemaIdentifier();
-	        if ((recordSchemaIdentifier != null) &&
-	                !recordSchemaIdentifier.equals(CLARIN_FCS_RECORD_SCHEMA)) {
-	            throw new SRUException(
-	                    SRUConstants.SRU_UNKNOWN_SCHEMA_FOR_RETRIEVAL,
-	                    recordSchemaIdentifier, "Record schema \"" +
-	                    recordSchemaIdentifier +
-	                    "\" is not supported by this endpoint.");
-	        }
+
+	private void checkRequestRecordSchema(SRURequest request)
+			throws SRUException {
+		final String recordSchemaIdentifier = request
+				.getRecordSchemaIdentifier();
+		if ((recordSchemaIdentifier != null)
+				&& !recordSchemaIdentifier.equals(CLARIN_FCS_RECORD_SCHEMA)) {
+			throw new SRUException(
+					SRUConstants.SRU_UNKNOWN_SCHEMA_FOR_RETRIEVAL,
+					recordSchemaIdentifier, "Record schema \""
+							+ recordSchemaIdentifier
+							+ "\" is not supported by this endpoint.");
+		}
 	}
 
 	private String getRequestDataView(String requestDataview,
@@ -205,6 +210,4 @@
 		}
 		return korapEndpointDescription.getDefaultDataView();
 	}
-
-		
 }
diff --git a/src/main/java/de/mannheim/ids/korap/sru/QueryLanguage.java b/src/main/java/de/mannheim/ids/korap/sru/QueryLanguage.java
new file mode 100644
index 0000000..98d2d28
--- /dev/null
+++ b/src/main/java/de/mannheim/ids/korap/sru/QueryLanguage.java
@@ -0,0 +1,5 @@
+package de.mannheim.ids.korap.sru;
+
+public enum QueryLanguage {
+	CQL, FCSQL;
+}
diff --git a/src/main/webapp/WEB-INF/endpoint-description.xml b/src/main/webapp/WEB-INF/endpoint-description.xml
new file mode 100644
index 0000000..1bd2b25
--- /dev/null
+++ b/src/main/webapp/WEB-INF/endpoint-description.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--

+    This file has the same format as the XML serialization of endpoint

+    description from the CLARIN-FCS specification.

+-->

+<EndpointDescription xmlns="http://clarin.eu/fcs/endpoint-description"

+    version="2">

+    <Capabilities>

+        <Capability>http://clarin.eu/fcs/capability/basic-search</Capability>

+        <Capability>http://clarin.eu/fcs/capability/advanced-search</Capability>

+    </Capabilities>

+    <SupportedDataViews>

+        <SupportedDataView id="hits" delivery-policy="send-by-default">application/x-clarin-fcs-hits+xml</SupportedDataView>

+        <SupportedDataView id="adv" delivery-policy="send-by-default">application/x-clarin-fcs-adv+xml</SupportedDataView>

+        <SupportedDataView id="kwic" delivery-policy="need-to-request">application/x-clarin-fcs-kwic+xml</SupportedDataView>

+    </SupportedDataViews>

+    <SupportedLayers>

+        <SupportedLayer id="l1" result-id="http://clarin.ids-mannheim.de/korapsru/layers/text">text</SupportedLayer>

+        <SupportedLayer id="l2" result-id="http://clarin.ids-mannheim.de/korapsru/layers/pos1" qualifier="cnx"

+        	alt-value-info="based on STTS tagset"

+        	alt-value-info-uri="http://www.ims.uni-stuttgart.de/forschung/ressourcen/lexika/TagSets/stts-table.html">pos</SupportedLayer>

+        <SupportedLayer id="l3" result-id="http://clarin.ids-mannheim.de/korapsru/layers/pos2" qualifier="tt"

+            alt-value-info="based on STTS tagset"

+            alt-value-info-uri="http://www.ims.uni-stuttgart.de/forschung/ressourcen/lexika/TagSets/stts-table.html">pos</SupportedLayer>

+        <SupportedLayer id="l4" result-id="http://clarin.ids-mannheim.de/korapsru/layers/pos3" qualifier="opennlp"

+            alt-value-info="based on STTS tagset"

+            alt-value-info-uri="http://www.ims.uni-stuttgart.de/forschung/ressourcen/lexika/TagSets/stts-table.html">pos</SupportedLayer>

+       <SupportedLayer id="l5" result-id="http://clarin.ids-mannheim.de/korapsru/layers/pos4" qualifier="mate"

+            alt-value-info="based on STTS tagset"

+            alt-value-info-uri="http://www.ims.uni-stuttgart.de/forschung/ressourcen/lexika/TagSets/stts-table.html">pos</SupportedLayer>        

+        <SupportedLayer id="l6" result-id="http://clarin.ids-mannheim.de/korapsru/layers/pos5" qualifier="xip"

+            alt-value-info="based on STTS tagset"

+            alt-value-info-uri="http://www.ims.uni-stuttgart.de/forschung/ressourcen/lexika/TagSets/stts-table.html">pos</SupportedLayer>       

+        <SupportedLayer id="l7" result-id="http://clarin.ids-mannheim.de/korapsru/layers/lemma1" qualifier="cnx">lemma</SupportedLayer>

+        <SupportedLayer id="l8" result-id="http://clarin.ids-mannheim.de/korapsru/layers/lemma2" qualifier="tt">lemma</SupportedLayer>

+        <SupportedLayer id="l9" result-id="http://clarin.ids-mannheim.de/korapsru/layers/lemma3" qualifier="mate">lemma</SupportedLayer>

+        <SupportedLayer id="l10" result-id="http://clarin.ids-mannheim.de/korapsru/layers/lemma4" qualifier="xip">lemma</SupportedLayer>

+    </SupportedLayers>

+    <Resources>

+     	<Resource pid="dummy pid">

+           <Title xml:lang="en">dummy resource</Title>

+           <Languages>

+               <Language>deu</Language>

+           </Languages>

+           <AvailableDataViews ref="hits"/>

+        </Resource>

+    </Resources>

+</EndpointDescription>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 6f63574..d651b31 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -9,7 +9,11 @@
   <servlet>
     <display-name>KorAP SRU/CQL Service (HTTP Interface)</display-name>
     <servlet-name>KorapSRU</servlet-name>
-    <servlet-class>eu.clarin.sru.server.utils.SRUServerServlet</servlet-class>    
+    <servlet-class>eu.clarin.sru.server.utils.SRUServerServlet</servlet-class>
+    <!-- <init-param>
+        <param-name>de.mannheim.ids.korap.sru.indexDir</param-name>
+        <param-value>/usr/local/java/apps/korapsru/index</param-value>
+    </init-param>     -->
     <init-param>
         <param-name>eu.clarin.sru.server.numberOfRecords</param-name>
         <param-value>25</param-value>
@@ -50,10 +54,10 @@
     	<param-name>eu.clarin.sru.server.legacyNamespaceMode</param-name>
     	<param-value>loc</param-value>
     </init-param>
-    <!-- <init-param>
+    <init-param>
     	<param-name>eu.clarin.sru.server.sruSupportedVersionMax</param-name>
     	<param-value>2.0</param-value>
-    </init-param> -->
+    </init-param>
     <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
diff --git a/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java b/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java
index 845a288..83b8d5d 100644
--- a/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java
+++ b/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java
@@ -7,6 +7,7 @@
 
 import de.mannheim.ids.korap.sru.KorapClient;
 import de.mannheim.ids.korap.sru.KorapResult;
+import de.mannheim.ids.korap.sru.QueryLanguage;
 
 
 public class KorapClientTest {
@@ -16,7 +17,8 @@
 		KorapClient c = new KorapClient(25,50);
 		
 //		prox Kuh
-		KorapResult result = c.query("Haus", "1.2", 1, 5, null);
+		KorapResult result = c.query("Haus", QueryLanguage.CQL, "1.2", 1, 5,
+				null);
 		//System.out.println(result.getMatches().size());
 		
 	}