Skip to content

Commit

Permalink
Merge pull request #8958 from nextcloud/backport/8953/stable3.4
Browse files Browse the repository at this point in the history
[stable3.4] fix(search): Use corresponding table alias for recipient search
  • Loading branch information
ChristophWurst authored Oct 11, 2023
2 parents c1f32fa + c8ddbed commit 5a8bb85
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Db/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$select->andWhere(
$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));
return $qb->expr()->iLike('r1.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getTo()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
return $qb->expr()->iLike('r1.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getTo()),
)
);
Expand All @@ -770,10 +770,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$select->andWhere(
$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));
return $qb->expr()->iLike('r2.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getCc()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
return $qb->expr()->iLike('r2.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getCc()),
)
);
Expand All @@ -782,10 +782,10 @@ public function findIdsByQuery(Mailbox $mailbox, SearchQuery $query, ?int $limit
$select->andWhere(
$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));
return $qb->expr()->iLike('r3.email', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($email) . '%', IQueryBuilder::PARAM_STR));
}, $query->getBcc()),
...array_map(function (string $label) use ($qb) {
return $qb->expr()->iLike('r0.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
return $qb->expr()->iLike('r3.label', $qb->createNamedParameter('%' . $this->db->escapeLikeParameter($label) . '%', IQueryBuilder::PARAM_STR));
}, $query->getBcc()),
)
);
Expand Down

0 comments on commit 5a8bb85

Please sign in to comment.