Plack-App-Catmandu-SRU
view release on metacpan or search on metacpan
store
Name of Catmandu store in your catmandu store configuration
Default: default
bag
Name of Catmandu bag in your catmandu store configuration
Default: data
This must be a bag that implements Catmandu::CQLSearchable, and that
configures a cql_mapping
cql_filter
A CQL query to find all records in the database that should be made
available to SRU
default_record_schema
default metadata schema all records are shown in, when SRU parameter
recordSchema is not gi en . Should be one listed in record_schemas
limit
The default number of records to be returned in each SRU request,
when SRU parameter maximumRecords is not given during a
searchRetrieve request.
When not provided in the constructor, it is derived from the default
limit of your catmandu bag (see Catmandu::Searchable#default_limit)
maximum_limit
The maximum value allowed for request parameter maximumRecords.
When not provided in the constructor, it is derived from the maximum
limit of your catmandu bag (see Catmandu::Searchable#maximum_limit)
record_schemas
An array of all supported record schemas. Each item in the array is
an object with attributes:
* identifier - The SRU identifier for the schema (see
http://www.loc.gov/standards/sru/recordSchemas/)
* name - A short descriptive name for the schema
* fix - Optionally an array of fixes to apply to the records before
they are transformed into XML
* template - The path to a Template Toolkit file to transform your
records into this format
template_options
An optional hash of configuration options that will be passed to
Catmandu::Exporter::Template or Template
content_type
Set a custom content type header, the default is text/xml.
title
Title shown in databaseInfo
description
Description shown in databaseInfo
default_search_params
Extra search parameters added during search in your catmandu bag:
$bag->search(
%{$self->default_search_params},
cql_query => $cql,
sru_sortkeys => $request->sortKeys,
limit => $limit,
start => $first - 1,
);
Must be a hash reference
Note that search parameter cql_query, sru_sortkeys, limit and start
are overwritten
As this is meant as a drop in replacement for
Dancer::Plugin::Catmandu::SRU all arguments should be the same.
So all arguments can be taken from your previous dancer plugin
configuration, if necessary:
use Dancer;
use Catmandu;
use Plack::Builder;
use Plack::App::Catmandu::SRU;
my $dancer_app = sub {
Dancer->dance(Dancer::Request->new(env => $_[0]));
};
builder {
enable 'ReverseProxy';
enable '+Dancer::Middleware::Rebase', base => Catmandu->config->{uri_base}, strip => 1;
mount "/sru" => Plack::App::Catmandu::SRU->new(
%{config->{plugins}->{'Catmandu::SRU'}}
)->to_app;
mount "/" => builder {
# only create session cookies for dancer application
enable "Session";
mount '/' => $dancer_app;
};
};
( run in 6.133 seconds using v1.01-cache-2.11-cpan-b301d465b3d )