Difference between revisions of "SRU Facilities"
(→Java Client (Stateful)) |
|||
(5 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:TO BE REMOVED]] | ||
+ | |||
=Introduction= | =Introduction= | ||
− | The SRU components have been created in the context of the | + | The [http://www.loc.gov/standards/sru/sru-1-1.html SRU] components have been created in the context of the [http://en.wikipedia.org/wiki/Federated_search Federated Search]. Federated Search has the following benefits: |
*Search space is expanded as new datasources come in | *Search space is expanded as new datasources come in | ||
*The complexity of search and index to the datasource providers | *The complexity of search and index to the datasource providers | ||
Line 16: | Line 18: | ||
*an SRU consumer service that is used in order to exploit external SRU providers | *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 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 | + | *an SRU adapter service for SearchSystem that is used in order to provide SRU capabilities to [https://gcube.wiki.gcube-system.org/gcube/index.php/Search_Framework_2.0 gCube SearchSystem] |
− | + | ||
=SRU Search System Adapter= | =SRU Search System Adapter= | ||
Line 130: | Line 131: | ||
*explain : http://dl08.di.uoa.gr:8080/sru-search-adapter-service | *explain : http://dl08.di.uoa.gr:8080/sru-search-adapter-service | ||
*search: http://dl08.di.uoa.gr:8080/sru-search-adapter-service?query=title+%3D+%22tuna%22&version=1.1&operation=searchRetrieve | *search: http://dl08.di.uoa.gr:8080/sru-search-adapter-service?query=title+%3D+%22tuna%22&version=1.1&operation=searchRetrieve | ||
+ | |||
+ | |||
+ | =SRU Consumer= | ||
+ | |||
+ | SRU Search System Adapter is consisted by a few components that are available in our Maven repositories with the following coordinates | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <!-- 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> | ||
+ | |||
+ | </source> | ||
+ | ==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 | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <!-- 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== |
Latest revision as of 18:39, 6 July 2016
Contents
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
- explain : http://dl08.di.uoa.gr:8080/sru-search-adapter-service
- search: http://dl08.di.uoa.gr:8080/sru-search-adapter-service?query=title+%3D+%22tuna%22&version=1.1&operation=searchRetrieve
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==