Using the FCSSimpleEndpoint 1.3.0 release and SRUServer 1.8.0.
diff --git a/pom.xml b/pom.xml
index ea5cb49..4f31fd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
<dependency>
<groupId>eu.clarin.sru.fcs</groupId>
<artifactId>fcs-simple-endpoint</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
@@ -67,13 +67,14 @@
<artifactId>org.apache.commons.lang</artifactId>
<version>2.6</version>
</dependency>
- </dependencies>
-
- <repositories>
+ </dependencies>
+
+ <!-- <repositories>
<repository>
- <id>clarin</id>
+ <id>CLARIN</id>
+ <url>https://nexus.clarin.eu/content/repositories/Clarin</url>
<url>http://catalog.clarin.eu/ds/nexus/content/repositories/Clarin/</url>
<layout>default</layout>
- </repository>
- </repositories>
+ </repository>
+ </repositories> -->
</project>
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 2e7d1f2..6762b63 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
@@ -16,13 +16,13 @@
import eu.clarin.sru.server.fcs.DataView;
import eu.clarin.sru.server.fcs.DataView.DeliveryPolicy;
import eu.clarin.sru.server.fcs.EndpointDescription;
+import eu.clarin.sru.server.fcs.Layer;
import eu.clarin.sru.server.fcs.ResourceInfo;
public class KorapEndpointDescription implements EndpointDescription {
private List<DataView> dataviews;
private List<URI> capabilities;
-
private List<String> languages;
private String defaultDataview = "hits";
@@ -90,7 +90,7 @@
ResourceInfo ri = new ResourceInfo(r.get("id").asText(), title,
description, KorapSRU.KORAP_WEB_URL, languages, dataviews,
- null);
+ this.getSupportedLayers(), null);
resourceList.add(ri);
}
@@ -105,4 +105,9 @@
this.defaultDataview = defaultDataview;
}
+ @Override
+ public List<Layer> getSupportedLayers() {
+ return null;
+ }
+
}
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 e36713e..80e01af 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
@@ -10,10 +10,12 @@
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;
import eu.clarin.sru.server.SRUException;
+import eu.clarin.sru.server.SRUQueryParserRegistry;
import eu.clarin.sru.server.SRURequest;
import eu.clarin.sru.server.SRUSearchResultSet;
import eu.clarin.sru.server.SRUServerConfig;
@@ -28,10 +30,8 @@
* */
public class KorapSRU extends SimpleEndpointSearchEngineBase{
-// private static final String RESOURCE_INFO_INVENTORY_URL =
-// "/WEB-INF/resource-info.xml";
public static final String CLARIN_FCS_RECORD_SCHEMA =
- "http://clarin.eu/fcs/1.0";
+ "http://clarin.eu/fcs/resource";
public static final String KORAP_WEB_URL =
"http://korap.ids-mannheim.de/kalamar";
@@ -53,8 +53,9 @@
@Override
protected void doInit(ServletContext context, SRUServerConfig config,
- Map<String, String> params) throws SRUConfigException {
-
+ SRUQueryParserRegistry.Builder parserRegistryBuilder,
+ Map<String, String> params)
+ throws SRUConfigException {
serverConfig = config;
korapClient = new KorapClient(config.getNumberOfRecords(),
config.getMaximumRecords());
@@ -84,7 +85,17 @@
request.getExtraRequestData("x-fcs-dataviews"), diagnostics);
}
- String korapQuery = translateCQLtoKorapQuery(request.getQuery());
+ if (!request.isQueryType(Constants.FCS_QUERY_TYPE_CQL)) {
+ 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";
@@ -155,7 +166,7 @@
}
}
- private String translateCQLtoKorapQuery(CQLNode query) throws SRUException {
+ private String translateCQLtoKorapQuery(CQLNode query) throws SRUException {
String queryStr = query.toString();
if ((queryStr == null) || queryStr.isEmpty()) {
throw new SRUException(SRUConstants.SRU_EMPTY_TERM_UNSUPPORTED,
@@ -194,5 +205,6 @@
}
return korapEndpointDescription.getDefaultDataView();
}
+
}
diff --git a/src/main/webapp/WEB-INF/sru-server-config.xml b/src/main/webapp/WEB-INF/sru-server-config.xml
index 45be806..4f2bef6 100644
--- a/src/main/webapp/WEB-INF/sru-server-config.xml
+++ b/src/main/webapp/WEB-INF/sru-server-config.xml
@@ -10,9 +10,9 @@
</databaseInfo>
<indexInfo>
- <set name="fcs" identifier="clarin.eu/fcs/1.0">
- <title xml:lang="de">CLARIN Content Search</title>
- <title xml:lang="en" primary="true">CLARIN Content Search</title>
+ <set name="fcs" identifier="http://clarin.eu/fcs/resource">
+ <title xml:lang="de">CLARIN Federated Content Search</title>
+ <title xml:lang="en" primary="true">CLARIN Federated Content Search</title>
</set>
<index search="true" scan="false" sort="false">
<title xml:lang="en" primary="true">Words</title>
@@ -23,9 +23,9 @@
</indexInfo>
<schemaInfo>
- <schema identifier="http://clarin.eu/fcs/1.0" name="fcs"
+ <schema identifier="http://clarin.eu/fcs/resource" name="fcs"
sort="false" retrieve="true">
- <title xml:lang="en" primary="true">CLARIN Content Search</title>
+ <title xml:lang="en" primary="true">CLARIN Federated Content Search</title>
</schema>
</schemaInfo>
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index b1cc769..6f63574 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -46,6 +46,14 @@
<param-name>eu.clarin.sru.server.utils.sruServerSearchEngineClass</param-name>
<param-value>de.mannheim.ids.korap.sru.KorapSRU</param-value>
</init-param>
+ <init-param>
+ <param-name>eu.clarin.sru.server.legacyNamespaceMode</param-name>
+ <param-value>loc</param-value>
+ </init-param>
+ <!-- <init-param>
+ <param-name>eu.clarin.sru.server.sruSupportedVersionMax</param-name>
+ <param-value>2.0</param-value>
+ </init-param> -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>