Replace old backend with new backend

Change-Id: I62640f31a05f9d90718950808662b8124155ef58
diff --git a/templates/failure.html.ep b/templates/failure.html.ep
index d9673b6..509333a 100644
--- a/templates/failure.html.ep
+++ b/templates/failure.html.ep
@@ -2,7 +2,7 @@
 
 <div id="resultinfo"><p class="found"></p></div>
 
-%= include 'query2'
+%= include 'query'
 
 <p class="no-results"><%= loc('notIssued') %></p>
 % if (stash('err_msg')) {
diff --git a/templates/query.html.ep b/templates/query.html.ep
index b3e52fd..fa9980c 100644
--- a/templates/query.html.ep
+++ b/templates/query.html.ep
@@ -1,8 +1,8 @@
 % use Mojo::JSON 'encode_json';
 
-% if (search->api_response) {
+% if (stash('api_response')) {
 %=  javascript begin
-%   my $kq_hash = search->api_response;
+%   my $kq_hash = stash('api_response');
 %   $kq_hash->{matches} = ["..."];
   KorAP.koralQuery = <%= b(encode_json($kq_hash))->decode %>;
 %   end
diff --git a/templates/query2.html.ep b/templates/query2.html.ep
deleted file mode 100644
index fa9980c..0000000
--- a/templates/query2.html.ep
+++ /dev/null
@@ -1,9 +0,0 @@
-% use Mojo::JSON 'encode_json';
-
-% if (stash('api_response')) {
-%=  javascript begin
-%   my $kq_hash = stash('api_response');
-%   $kq_hash->{matches} = ["..."];
-  KorAP.koralQuery = <%= b(encode_json($kq_hash))->decode %>;
-%   end
-% };
diff --git a/templates/search.html.ep b/templates/search.html.ep
index 21589ee..be95990 100644
--- a/templates/search.html.ep
+++ b/templates/search.html.ep
@@ -1,17 +1,17 @@
-% layout 'main', title => loc('searchtitle', q => search->query, ql => search->query_language), schematype => 'SearchResultsPage';
+% layout 'main', title => loc('searchtitle', q => stash('q'), ql => stash('ql')), schematype => 'SearchResultsPage';
 
-<div id="resultinfo" <% if (search->results->size) { %> class="found"<%} %>>
-  <div id="pagination"><%= pagination(search->start_page, search->total_pages, url_with->query(['p' => '{page}'])) =%></div>
-% my $found = search->total_results;
+<div id="resultinfo" <% if (stash('results')->size) { %> class="found"<%} %>>
+  <div id="pagination"><%= pagination(stash('start_page'), stash('total_pages'), url_with->query(['p' => '{page}'])) =%></div>
+% my $found = stash('total_results') // 0;
   <p class="found">\
 % if ($found != -1) {
 %   my $found_text = loc('numf', number => $found);
-%   if (search->time_exceeded) {
+%   if (stash('time_exceeded')) {
 %     $found_text = '> ' . $found_text;
 %   };
 <span id="total-results"><%= $found_text %></span> <%= loc('matchCount', found => $found) %>\
-%# <% if (search->benchmark) { %> (~ <%= search->benchmark %>)<% } %>
-% } elsif (search->start_index == 0 && search->results->size == 0) {
+%# <% if (stash('benchmark')) { %> (~ <%= stash('benchmark') %>)<% } %>
+% } elsif (stash('start_index') == 0 && stash('results')->size == 0) {
 <span id="total-results">0</span> <%= loc('matchCount', found => $found) %>\
 % };
 </p>
@@ -20,13 +20,13 @@
 %= include 'query'
 
 <div id="search">
-% if (search->total_results != 0 && search->results->size) {
+% if (stash('results')->size && stash('total_results') != 0) {
   <ol class="align-left">
 %=  search_results begin
 %=    include 'match', match => $_
 %   end
   </ol>
-% } elsif (search->results->size == 0) {
-<p id="no-results"><%= loc 'noMatches', q => search->query, ql => search->query_language %></p>
+% } elsif (stash('results')->size == 0) {
+<p class="no-results"><%= loc 'noMatches', q => stash('q'), ql => stash('ql') %></p>
 % }
 </div>
diff --git a/templates/search2.html.ep b/templates/search2.html.ep
deleted file mode 100644
index 907cc03..0000000
--- a/templates/search2.html.ep
+++ /dev/null
@@ -1,32 +0,0 @@
-% layout 'main', title => loc('searchtitle', q => stash('q'), ql => stash('ql')), schematype => 'SearchResultsPage';
-
-<div id="resultinfo" <% if (stash('results')->size) { %> class="found"<%} %>>
-  <div id="pagination"><%= pagination(stash('start_page'), stash('total_pages'), url_with->query(['p' => '{page}'])) =%></div>
-% my $found = stash('total_results') // 0;
-  <p class="found">\
-% if ($found != -1) {
-%   my $found_text = loc('numf', number => $found);
-%   if (stash('time_exceeded')) {
-%     $found_text = '> ' . $found_text;
-%   };
-<span id="total-results"><%= $found_text %></span> <%= loc('matchCount', found => $found) %>\
-%# <% if (stash('benchmark')) { %> (~ <%= stash('benchmark') %>)<% } %>
-% } elsif (stash('start_index') == 0 && stash('results')->size == 0) {
-<span id="total-results">0</span> <%= loc('matchCount', found => $found) %>\
-% };
-</p>
-</div>
-
-%= include 'query2'
-
-<div id="search">
-% if (stash('results')->size && stash('total_results') != 0) {
-  <ol class="align-left">
-%=  search_results2 begin
-%=    include 'match', match => $_
-%   end
-  </ol>
-% } elsif (stash('results')->size == 0) {
-<p class="no-results"><%= loc 'noMatches', q => stash('q'), ql => stash('ql') %></p>
-% }
-</div>