SRU Facilities

From Gcube Wiki
Jump to: navigation, search


Introduction

The SRU components have been created in the context of the Federated Search. Federated Search has the following benefits:

  • Search space is expanded as new datasources come in
  • The complexity of search and index to the datasource providers

By enabling Federated Search gCube can benefit by:

  • Getting more external sources:
    • External providers that comply with SRU can be used directly as external datasources
    • External providers that do not comply with SRU can be used indirectly as external datasources through SRU Adapters
  • Providing gCube datasources to others:
    • gCube SearchSystem can be used by others


In order to utilize the above benefits we have developed the following components:

  • an SRU consumer service that is used in order to exploit external SRU providers
  • an SRU adapter service for RDBMSs that is used in order to provide SRU capabilities to RBMSs
  • an SRU adapter service for SearchSystem that is used in order to provide SRU capabilities to gCube SearchSystem

SRU Search System Adapter

The SRU Search System Adapter is a service that is used in order to provide SRU capabilities to the gCube SearchSystem and thus be used by external datasources. Although the SRU Search System Adapter service can be used directly from the HTTP API it can also be used through the Java client of the service.

SRU Search System Adapter is consisted by a few components that are available in our Maven repositories with the following coordinates

<!-- sru search adapter service web app -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-search-adapter-service</artifactId>
<version>...</version>
 
 
<!-- sru search adapter service commons library -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-search-adapter-commons</artifactId>
<version>...</version>
 
<!-- sru search adapter service client library -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-search-adapter-client</artifactId>
<version>...</version>

Implementation Details

SRU Search Adapter Service can run both as a stateful or as a stateless service. Each one has some pros and cons. If the service is stateful then only one running instance is required in order to provide SRU to SearchSystem Services from multiple scopes but this requires smartgears to be deployed along with the service and pass scope on each HTTP call to the service, which means that a standard SRU client might not work. On the other hand, stateless requires to have one running instance for each SearchSystem Service.

We strongly recommend to use and deploy SRU Search Adapter as a stateless service.

Deployment Instructions

In order to deploy and run SRU Search System Adapter service on a node we will need the following:

  • sru-search-adapter-service-{version}.war
  • an application server (such as Tomcat, JBoss, Jetty)
  • (in case of stateful only) smartgears-distribution-{version}.tar.gz (to publish the running instance of the service on the IS and be discoverable)
    • see here for installation


NOTE: smartgears should not be deployed if SRU Search Adapter Service will operate as a stateless service

There are a few things that need to configured in order for the service to be functional. All the service configuration is done in the file deploy.properties that comes within the service war. Typically, this file should be loaded in the classpath so that it can be read. The default location of this file (in the exploded war) is webapps/service/WEB-INF/classes.

The hostname of the node as well as the scope that the node is running on have to set in the in the variables hostname and scope in the deploy.properties.

NOTE: The Stateless SRU Search Adapter Service must run on the same (VRE) scope as the SearchSystem on which it will provide the SRU capabilities. Also SRU Search System Adapter runs without ResourceRegistry


hostname=dl015.madgik.di.uoa.gr
scope=/gcube/devNext/NextNext

Usage Example

Java Client (Stateless)

String query = "title = tuna";
Integer maxRecords = 4;
String recordSchema = “oai_dc”;
 
 
final String scope = "/gcube/devNext/NextNext";
final String endpoint = "http://dl08.di.uoa.gr:8080/sru-search-adapter-service";
 
 
SruSearchAdapterStatelessClient client = new SruSearchAdapterStatelessClient.Builder()
		.endpoint(endpoint)
		.scope(scope)
		.build();
 
 
 
String searchResponse = client.searchRetrieve(1.1f, "", query, maxRecords, recordSchema);
String explain = client.explain();


Java Client (Stateful)

SruSearchAdapterFactoryClient factory = new SruSearchAdapterFactoryClient.Builder()
				.endpoint(endpoint)
				.scope(scope)
				.build();
 
 
String searchSystemEndpoint = "http://localhost:8080/searchsystemservice";
String hostname = "localhost";
 
SruSearchAdapterResource resource = new SruSearchAdapterResource();
resource.setHostname(hostname);
resource.setPort(8080);
resource.setSearchSystemEndpoint(searchSystemEndpoint);
 
String resourceID = factory.createResource(resource, scope);
 
SruSearchAdapterClient client = new SruSearchAdapterClient.Builder()
			.endpoint(endpoint)
			.scope(scope)
			.resourceID(resourceID)
			.build();

HTTP


SRU Consumer

SRU Search System Adapter is consisted by a few components that are available in our Maven repositories with the following coordinates

<!-- sru consumer service web app -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-consumer-service</artifactId>
<version>...</version>
 
 
<!-- sru consumer service commons library -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-consumer-commons</artifactId>
<version>...</version>
 
<!-- sru consumer service client library -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-consumer-client</artifactId>
<version>...</version>

Deployment Instructions

Usage Examples

SRU RDBMS Adapter

SRU Search System Adapter is consisted by a few components that are available in our Maven repositories with the following coordinates

<!-- sru db adapter service web app -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-db-adapter-service</artifactId>
<version>...</version>
 
 
<!-- sru db adapter service commons library -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-db-adapter-commons</artifactId>
<version>...</version>
 
<!-- sru db adapter service client library -->
<groupId>org.gcube.search.sru</groupId>
<artifactId>sru-db-adapter-client</artifactId>
<version>...</version>
 
==Deployment Instructions==
 
==Usage Examples==