Improved response view
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 60833a8..7af4508 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -82,6 +82,10 @@
# Base query route
$r->get('/')->to('search#query')->name('index');
+ # Collection route
+ $r->get('/collection')->to('Search#collections')->name('collections');
+ $r->get('/collection/:id')->to('Search#collection')->name('collection');
+
# Documentation routes
$r->get('/doc')->to('documentation#page', page => 'korap')->name('doc_start');
$r->get('/doc/:page')->to('documentation#page', scope => undef);
diff --git a/lib/Kalamar/API.pm b/lib/Kalamar/API.pm
index a41550b..fa5d4db 100644
--- a/lib/Kalamar/API.pm
+++ b/lib/Kalamar/API.pm
@@ -427,6 +427,9 @@
$index->collection_jsonld($json->{request}->{collection});
};
+ # Temp
+ $index->collection_jsonld($collection_query);
+
$index->results(_map_matches($json->{matches}));
# Total results not set by stash
diff --git a/lib/Kalamar/Controller/Search.pm b/lib/Kalamar/Controller/Search.pm
index 66b602e..8445c9f 100644
--- a/lib/Kalamar/Controller/Search.pm
+++ b/lib/Kalamar/Controller/Search.pm
@@ -50,10 +50,10 @@
) if $query;
# Search resource (async)
- $c->search->resource(
- type => 'collection',
- $delay->begin
- );
+ # $c->search->resource(
+ # type => 'collection',
+ # $delay->begin
+ # );
},
# Collected search
@@ -121,6 +121,23 @@
};
+# Get information about collections
+sub collections {
+ my $c = shift;
+
+ # Async
+ $c->render_later;
+
+ # Get resource (for all)
+ $c->search->resource(
+ type => 'collection',
+ sub {
+ my $notes = $c->notifications(json => $c->stash('search.resource'));
+ return $c->render(json => $notes);
+ }
+ );
+};
+
1;