Return NOMOREDOCS constant on skip_doc

Change-Id: I65a9511c29cbac342f00f0dda0cb2206215ddfee
diff --git a/lib/Krawfish/Corpus/And.pm b/lib/Krawfish/Corpus/And.pm
index bf5542d..726145d 100644
--- a/lib/Krawfish/Corpus/And.pm
+++ b/lib/Krawfish/Corpus/And.pm
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use Role::Tiny::With;
+use Krawfish::Util::Constants qw/NOMOREDOCS/;
 use List::Util qw/min/;
 use Scalar::Util qw/refaddr/;
 use Krawfish::Log;
@@ -105,7 +106,7 @@
           );
       };
 
-      unless (defined $self->{first}->skip_doc($second->doc_id)) {
+      if ($self->{first}->skip_doc($second->doc_id) == NOMOREDOCS) {
         $self->{doc_id} = undef;
         return;
       }
diff --git a/lib/Krawfish/Corpus/Cache.pm b/lib/Krawfish/Corpus/Cache.pm
index 556f43c..a1fa528 100644
--- a/lib/Krawfish/Corpus/Cache.pm
+++ b/lib/Krawfish/Corpus/Cache.pm
@@ -4,6 +4,7 @@
 use Role::Tiny;
 use Krawfish::Index::Stream;
 use Krawfish::Cache;
+use Krawfish::Util::Constants qw/NOMOREDOCS/;
 
 with 'Krawfish::Corpus';
 
@@ -30,6 +31,9 @@
 #    be indexed next time
 #  - the signature of the koralquery can be used for caching
 
+# TODO:
+#   - support corpus classes
+
 # A cache may not necessarily be invalidated.
 # It may be filtered using the live document vector (so it is
 # not necessary to invalidate all caches on an updated)
@@ -105,7 +109,7 @@
     return $self->{doc_id} if $doc_id >= $self->{doc_id};
   };
 
-  return;
+  return NOMOREDOCS;
 };
 
 
diff --git a/lib/Krawfish/Corpus/Class.pm b/lib/Krawfish/Corpus/Class.pm
index 2ef7363..265f18b 100644
--- a/lib/Krawfish/Corpus/Class.pm
+++ b/lib/Krawfish/Corpus/Class.pm
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use Role::Tiny;
+use Krawfish::Util::Constants qw/NOMOREDOCS/;
 use Krawfish::Util::Bits qw/classes_to_flags bitstring/;
 use Krawfish::Log;
 
@@ -111,14 +112,14 @@
 # Skip to target document
 sub skip_doc {
   my $self = shift;
-  if ($self->{corpus}->skip_doc(shift)) {
+  if ($self->{corpus}->skip_doc(shift) != NOMOREDOCS) {
     my $current = $self->{corpus}->current;
     $self->{doc_id} = $current->doc_id;
     $self->{flags}  = $current->flags | $self->{flag};
     return $self->{doc_id};
   };
   $self->{doc_id} = undef;
-  return;
+  return NOMOREDOCS;
 };
 
 
diff --git a/lib/Krawfish/Corpus/Distribution.pm b/lib/Krawfish/Corpus/Distribution.pm
index 6120a1a..4b84c32 100644
--- a/lib/Krawfish/Corpus/Distribution.pm
+++ b/lib/Krawfish/Corpus/Distribution.pm
@@ -25,7 +25,10 @@
 #
 #   However - in case skips are not available,
 #   this may be slow ...
-#
+
+# TODO:
+#   Support corpus classes
+
 # TODO:
 #   Another distribution variant would be
 #   distr(doc[1:1]: 'author:Goethe', 'author:Schiller')