Remove non-necessary Span postings and queries
diff --git a/lib/Krawfish/Index/Stream/Span.pm b/lib/Krawfish/Index/Stream/Span.pm
index 5974a6e..05de891 100644
--- a/lib/Krawfish/Index/Stream/Span.pm
+++ b/lib/Krawfish/Index/Stream/Span.pm
@@ -1,6 +1,6 @@
package Krawfish::Index::Stream::Span;
use parent 'Krawfish::Index::Stream';
-use Krawfish::Posting::Span;
+use Krawfish::Posting::Token;
use strict;
use warnings;
@@ -85,7 +85,7 @@
sub posting {
shift;
- return Krawfish::Posting::Span->new(@_);
+ return Krawfish::Posting::Token->new(@_);
};
diff --git a/lib/Krawfish/Koral/Query/Span.pm b/lib/Krawfish/Koral/Query/Span.pm
index 3ad2e74..87374d3 100644
--- a/lib/Krawfish/Koral/Query/Span.pm
+++ b/lib/Krawfish/Koral/Query/Span.pm
@@ -1,15 +1,12 @@
package Krawfish::Koral::Query::Span;
use parent 'Krawfish::Koral::Query';
-use Krawfish::Koral::Query::SpanID;
+use Krawfish::Koral::Query::TermID;
use Krawfish::Koral::Query::Term;
use Krawfish::Log;
-# use Krawfish::Query::Span;
use Scalar::Util qw/blessed/;
use strict;
use warnings;
-# TODO: Rename 'wrap' to 'operand'
-
use constant DEBUG => 0;
sub new {
@@ -77,7 +74,7 @@
return $self->builder->nothing unless defined $term_id;
- return Krawfish::Koral::Query::SpanID->new($term_id);
+ return Krawfish::Koral::Query::TermID->new($term_id);
};
warn 'Regexes are currently not supported';
diff --git a/lib/Krawfish/Koral/Query/SpanID.pm b/lib/Krawfish/Koral/Query/SpanID.pm
deleted file mode 100644
index cc8859f..0000000
--- a/lib/Krawfish/Koral/Query/SpanID.pm
+++ /dev/null
@@ -1,33 +0,0 @@
-package Krawfish::Koral::Query::SpanID;
-use parent 'Krawfish::Koral::Query::Span';
-use Krawfish::Query::SpanID;
-use warnings;
-use strict;
-
-# TODO:
-# This may be irrelevant if the postings in
-# Krawfish::Query::Span/SpanID could be
-# more general.
-
-sub new {
- my ($class, $term_id) = @_;
- bless {
- term_id => $term_id
- }, $class;
-};
-
-sub type {
- 'spanid'
-};
-
-
-sub optimize {
- my ($self, $segment) = @_;
- return Krawfish::Query::SpanID->new($segment, $self->{term_id});
-};
-
-sub to_string {
- '#' . $_[0]->{term_id};
-};
-
-1;
diff --git a/lib/Krawfish/Posting/Span.pm b/lib/Krawfish/Posting/Span.pm
deleted file mode 100644
index ac045d6..0000000
--- a/lib/Krawfish/Posting/Span.pm
+++ /dev/null
@@ -1,34 +0,0 @@
-package Krawfish::Posting::Span;
-use parent 'Krawfish::Posting';
-use strict;
-use warnings;
-
-sub new {
- my $class = shift;
- bless [@_], $class;
-}
-
-# Current document
-sub doc_id {
- return $_[0]->[0];
-};
-
-
-# Start of span
-sub start {
- return $_[0]->[1];
-};
-
-
-# End of span
-sub end {
- return $_[0]->[2];
-};
-
-# Payloads
-sub payload {
- return $_[0]->[3] //= Krawfish::Posting::Payload->new;
-};
-
-
-1;
diff --git a/lib/Krawfish/Query/Filter.pm b/lib/Krawfish/Query/Filter.pm
index 27a04c4..075c3e5 100644
--- a/lib/Krawfish/Query/Filter.pm
+++ b/lib/Krawfish/Query/Filter.pm
@@ -37,7 +37,7 @@
my $span = $self->{span}->current;
- # No valid span
+ # Invalidate current if no current span exists
unless ($span) {
$self->{doc_id} = undef;
return;
@@ -45,6 +45,7 @@
my $doc = $self->{docs}->current;
+ # Invalidate current if no current doc exists
unless ($doc) {
$self->{doc_id} = undef;
return;
diff --git a/lib/Krawfish/Query/SpanID.pm b/lib/Krawfish/Query/SpanID.pm
deleted file mode 100644
index 450d56f..0000000
--- a/lib/Krawfish/Query/SpanID.pm
+++ /dev/null
@@ -1,25 +0,0 @@
-package Krawfish::Query::SpanID;
-use parent 'Krawfish::Query::TermID';
-use Krawfish::Index::PostingsList;
-use Krawfish::Posting::Span;
-use strict;
-use warnings;
-
-# ---------------------------
-# TODO:
-# May be useless, if Postings can be adjusted.
-# ---------------------------
-
-# TODO: Probably rename to posting - and return a posting
-# that augments the given payload
-sub current {
- my $postings = $_[0]->{postings};
- return if $postings->pos == -1;
- return unless $postings->current;
-
- Krawfish::Posting::Span->new(
- @{$postings->current}
- );
-};
-
-1;