Fixed bug in bundling
Change-Id: I35ebff1f3685b9121a9cd43beae913a4f5a91817
diff --git a/lib/Krawfish/Posting/Bundle.pm b/lib/Krawfish/Posting/Bundle.pm
index 79d679a..b05a398 100644
--- a/lib/Krawfish/Posting/Bundle.pm
+++ b/lib/Krawfish/Posting/Bundle.pm
@@ -27,7 +27,7 @@
# Return document id of the bundle
sub doc_id {
- return unless $_[0]->length;
+ return unless $_[0]->[0];
$_[0]->[0]->doc_id;
};
@@ -61,10 +61,22 @@
# Return length
sub length {
+ warn 'DEPRECATED';
scalar @{$_[0]};
};
+# Get the number of matches in the bundle
+sub matches {
+ my $self = shift;
+ my $matches = 0;
+ foreach (@$self) {
+ $matches += $_->matches;
+ };
+ return $matches;
+};
+
+
# Add match to match array
sub add {
my ($self, $obj) = @_;