summaryrefslogtreecommitdiff
path: root/lib/MaildirIndexer/Index
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MaildirIndexer/Index')
-rw-r--r--lib/MaildirIndexer/Index/ByAddresses.rakumod6
-rw-r--r--lib/MaildirIndexer/Index/ByRef.rakumod6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/MaildirIndexer/Index/ByAddresses.rakumod b/lib/MaildirIndexer/Index/ByAddresses.rakumod
index 0b77d15..033f4e9 100644
--- a/lib/MaildirIndexer/Index/ByAddresses.rakumod
+++ b/lib/MaildirIndexer/Index/ByAddresses.rakumod
@@ -110,14 +110,14 @@ submethod predict-mailbox-given-addresses(@addresses) {
return %prediction;
}
-method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) {
- my Str $result;
+method mailbox-for-email(MaildirIndexer::Email:D $email --> Mailbox) {
+ my Mailbox $result;
MaildirIndexer::LogTimelineSchema::Index::Find.log: :class('ByAddresses'), -> {
my %prediction = self.predict-mailbox-given-addresses($email.addresses);
my @most-probable-mailboxes = %prediction.pairs.sort(*.value);
- if @most-probable-mailboxes -> $_ { $result = .[*-1].key }
+ if @most-probable-mailboxes -> $_ { $result = Mailbox.new(:name(.key),:confidence(.value)) with .[*-1] }
}
return $result;
}
diff --git a/lib/MaildirIndexer/Index/ByRef.rakumod b/lib/MaildirIndexer/Index/ByRef.rakumod
index 6e5b7f5..30ea58c 100644
--- a/lib/MaildirIndexer/Index/ByRef.rakumod
+++ b/lib/MaildirIndexer/Index/ByRef.rakumod
@@ -35,11 +35,11 @@ method del-path(IO:D $file, Str:D $mailbox --> Nil) {
}
}
-method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) {
- my Str $result;
+method mailbox-for-email(MaildirIndexer::Email:D $email --> Mailbox) {
+ my Mailbox $result;
MaildirIndexer::LogTimelineSchema::Index::Find.log: :class('ByRef'), -> {
for |$email.refs() -> $ref {
- with %!mailboxes-for-id{$ref} { $result = .keys.sort.[0] }
+ with %!mailboxes-for-id{$ref} { $result = Mailbox.new(:name(.keys.sort.[0]),:1confidence) }
}
}
return $result;