Skip to content

Commit

Permalink
feat(search): Match recipient labels too
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Jul 24, 2023
1 parent 8955638 commit 102a070
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/Db/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$qb->expr()->orX(
...array_map(function (string $email) use ($qb) {
return $qb->expr()->iLike('r0.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getFrom())
}, $query->getFrom()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getFrom()),
)
);
}
Expand All @@ -755,7 +758,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$qb->expr()->orX(
...array_map(function (string $email) use ($qb) {
return $qb->expr()->iLike('r0.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getTo())
}, $query->getTo()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getTo()),
)
);
}
Expand All @@ -764,7 +770,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$qb->expr()->orX(
...array_map(function (string $email) use ($qb) {
return $qb->expr()->iLike('r0.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getCc())
}, $query->getCc()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getCc()),
)
);
}
Expand All @@ -773,7 +782,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$qb->expr()->orX(
...array_map(function (string $email) use ($qb) {
return $qb->expr()->iLike('r0.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getBcc())
}, $query->getBcc()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getBcc()),
)
);
}
Expand Down

0 comments on commit 102a070

Please sign in to comment.