Deployment preparation for testbed
diff --git a/lib/Korap/Search.pm b/lib/Korap/Search.pm
index 4773649..fd9e6d5 100644
--- a/lib/Korap/Search.pm
+++ b/lib/Korap/Search.pm
@@ -4,8 +4,10 @@
# This action will render a template
sub remote {
my $c = shift;
+ $c->layout('default');
+ $c->title('KorAP');
- if ($c->param('action') eq 'inspect') {
+ if ((scalar $c->param('action') // '') eq 'inspect') {
my $api = $c->config('KorAP')->{api};
my $url = Mojo::URL->new($api)->path('resource/query');
$url->query({
@@ -20,29 +22,29 @@
};
$c->param(cutoff => 1);
- return $c->render(template => 'query', layout => 'default', title => 'KorAP');
+ return $c->render(template => 'query');
+ }
+
+ elsif ($c->param('snippet')) {
+ $c->layout('snippet');
};
- # Render template "example/welcome.html.ep" with message
$c->render(template => 'search');
};
+
+
sub info {
my $c = shift;
my $api = $c->config('KorAP')->{api};
my $src = $c->stash('resource');
- $src = 'VirtualCollection' if $src eq 'collection';
- $src = 'Corpus' if $src eq 'corpus';
-
- my $url = Mojo::URL->new($api)->path('resource/' . $src);
- if (my $response = $c->ua->get($url)->success) {
- $c->render(json => $c->notifications(json => $response->json));
- };
+ $c->render(json => $c->notifications(json => $c->info_on($src)));
};
+
1;
__END__
-[{"id":1,"name":"Wikipedia","description":"Die freie Enzyklopädie","owner":0,"created":1401193381119,"managed":true,"shared":false,"foundries":"base;corenlp;mate;mpt;opennlp;tt;xip","refCorpus":"","query":"[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:term\",\"@field\":\"korap:field#corpusID\",\"@value\":\"WPD\"}}]","cache":false,"stats":"{\"documents\":196510,\"tokens\":51545081,\"sentences\":4116282,\"paragraphs\":2034752}"}]
+[{"shared":false,"id":1,"managed":true,"created":1401193381119,"stats":{"documents":196510,"tokens":51545081,"sentences":4116282,"paragraphs":2034752},"query":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"description":"Die freie Enzyklopädie","name":"Wikipedia","foundries":"base;corenlp;mate;mpt;opennlp;tt;xip"}]