Fixed minor deserialization bug and added Annis and CQL
diff --git a/lib/Korap/Plugin/KorapSearch.pm b/lib/Korap/Plugin/KorapSearch.pm
index a2c22bd..171c6e1 100644
--- a/lib/Korap/Plugin/KorapSearch.pm
+++ b/lib/Korap/Plugin/KorapSearch.pm
@@ -8,6 +8,7 @@
 # TODO: Write search snippet
 
 sub map_matches {
+  return [] unless $_[0];
   [
     map {
       $_->{ID} =~ s/^match\-[^!]+![^-]+-//;
@@ -147,7 +148,7 @@
 	# Reformat benchmark counter
 	my $b_hit    = $json->{benchmarkHitCounter};
 	my $b_search = $json->{benchmarkSearchResults};
-	if ($b_hit & $b_hit =~ s/\s+(m)?s$//) {
+	if ($b_hit && $b_hit =~ s/\s+(m)?s$//) {
 	  $b_hit = sprintf("%.2f", $b_hit) . ($1 ? $1 : '') . 's';
 	};
 	if ($b_search && $b_search =~ s/\s+(m)?s$//) {
diff --git a/public/favicon.ico b/public/favicon.ico
index b84dd71..7661e77 100644
--- a/public/favicon.ico
+++ b/public/favicon.ico
Binary files differ
diff --git a/templates/collections.html.ep b/templates/collections.html.ep
index 42ac9b3..046a3a8 100644
--- a/templates/collections.html.ep
+++ b/templates/collections.html.ep
@@ -4,7 +4,7 @@
   <li class="active" title="<%= $vc->{description} // '' %>"><h3><%= $vc->{name} %></h3>
 % my $stats = $vc->{statistics};
     <dl class="info">
-      <dt>Documents</dt>  <dd><%= commify $stats->{documents} %></dd>
+      <dt>Texts</dt>      <dd><%= commify($stats->{documents} // $stats->{texts}) %></dd>
       <dt>Paragraphs</dt> <dd><%= commify $stats->{paragraphs} %></dd>
       <dt>Sentences</dt>  <dd><%= commify $stats->{sentences} %></dd>
       <dt>Tokens</dt>     <dd><%= commify $stats->{tokens} %></dd>
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 9d1ee0c..7483c85 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -61,7 +61,7 @@
   <% if ($location) { %><%== $location %><% } %>
   with
   <div class="select">
-    %= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2']], id => 'ql-field'
+    %= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2'], ['Annis' => 'annis'], ['CQL v1.2' => 'cql']], id => 'ql-field'
   </div>
 
 
diff --git a/templates/tutorial/index.html.ep b/templates/tutorial/index.html.ep
index 42ff1fb..9b8e581 100644
--- a/templates/tutorial/index.html.ep
+++ b/templates/tutorial/index.html.ep
@@ -31,7 +31,7 @@
 <h3>Example Queries</h3>
 %# <p>This is a Tutorial to KorAP. It may be maintained separately (as a Wiki?) and has some nice features - like embedded example queries - just click on the queries below:</p>
 
-<p><strong>Poliqarp</strong>: Find all occurrences of the lemma &quot;baum&quot; as annotated by the default foundry.</p>
+<p><strong>Poliqarp</strong>: Find all occurrences of the lemma &quot;baum&quot; as annotated by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
 %= korap_tut_query poliqarp => '[base=baum]'
 
 <p><strong>Cosmas-II</strong>: Find all occurrences of the words &quot;der&quot; and &quot;Baum&quot;, in case they are in a maximum distance of 5 tokens. The order is not relevant.</p>
@@ -40,9 +40,13 @@
 <p><strong>Poliqarp+</strong>: Find all nominal phrases as annotated using Connexor, that contain an adverb as annotated by OpenNLP.</p>
 %= korap_tut_query poliqarp => 'contains(<cnx/c=np>,[opennlp/p=ADV])'
 
-<p><strong>Poliqarp+</strong>: Find all sentences as annotated by the base foundry that start with a sequence of one token in present tense as annotated by Connexor and the lemma &quot;der&quot; annotated by the default foundry. Highlight both terms of the sequence.</p>
+<p><strong>Poliqarp+</strong>: Find all sentences as annotated by the base foundry that start with a sequence of one token in present tense as annotated by Connexor and the lemma &quot;der&quot; annotated by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>. Highlight both terms of the sequence.</p>
 %= korap_tut_query poliqarp => 'startswith(<s>, {1:[cnx/m=PRES]}{2:[base=der]})'
 
+<p><strong>Annis</strong>: Find all occurrences of the sequence of two tokens annotated as adverbs by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
+%= korap_tut_query annis => 'pos="ADV" & pos="ADV" & #1 . #2'
+
+
 </section>
 
 % end
diff --git a/templates/tutorial/poliqarp-plus.html.ep b/templates/tutorial/poliqarp-plus.html.ep
index 3d48e24..d15a737 100644
--- a/templates/tutorial/poliqarp-plus.html.ep
+++ b/templates/tutorial/poliqarp-plus.html.ep
@@ -92,7 +92,6 @@
 %= korap_tut_query poliqarp => '[mate/m=number:pl]'
 
 <blockquote class="warning">
-  <p>There is currently a bug in the serialization of this query.</p>
   <p><strong>The following queries in the tutorial are not yet tested and may not work.</strong></p>
 </blockquote>
 
@@ -150,6 +149,8 @@
 
 <h4>Position Operators</h4>
 
+%#= korap_tut_query poliqarp => 'matches(<s>,[])'
+%# matches(<s>,[cnx/p=INTERJ]{2})
 <p>contains()</p>
 <p>startsWith()</p>
 <p>endsWith()</p>