diff --git a/lib/Db/MessageMapper.php b/lib/Db/MessageMapper.php index b6168d6e59..d8a003cbcb 100644 --- a/lib/Db/MessageMapper.php +++ b/lib/Db/MessageMapper.php @@ -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()), ) ); } @@ -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()), ) ); } @@ -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()), ) ); } @@ -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()), ) ); }