mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-27 12:01:49 +03:00
Ensured search terms are applied to the domain too
This commit is contained in:
parent
f7d54abb2b
commit
8ff913aaf2
2 changed files with 11 additions and 6 deletions
|
@ -110,12 +110,14 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply search conditions
|
// Apply search conditions
|
||||||
$qb->andWhere($qb->expr()->orX(
|
$qb->leftJoin('s.domain', 'd')
|
||||||
$qb->expr()->like('s.longUrl', ':searchPattern'),
|
->andWhere($qb->expr()->orX(
|
||||||
$qb->expr()->like('s.shortCode', ':searchPattern'),
|
$qb->expr()->like('s.longUrl', ':searchPattern'),
|
||||||
$qb->expr()->like('t.name', ':searchPattern'),
|
$qb->expr()->like('s.shortCode', ':searchPattern'),
|
||||||
));
|
$qb->expr()->like('t.name', ':searchPattern'),
|
||||||
$qb->setParameter('searchPattern', '%' . $searchTerm . '%');
|
$qb->expr()->like('d.authority', ':searchPattern'),
|
||||||
|
))
|
||||||
|
->setParameter('searchPattern', '%' . $searchTerm . '%');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by tags if provided
|
// Filter by tags if provided
|
||||||
|
|
|
@ -169,6 +169,9 @@ class ListShortUrlsTest extends ApiTestCase
|
||||||
self::SHORT_URL_META,
|
self::SHORT_URL_META,
|
||||||
self::SHORT_URL_CUSTOM_DOMAIN,
|
self::SHORT_URL_CUSTOM_DOMAIN,
|
||||||
]];
|
]];
|
||||||
|
yield [['searchTerm' => 'example.com'], [
|
||||||
|
self::SHORT_URL_CUSTOM_DOMAIN,
|
||||||
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildPagination(int $itemsCount): array
|
private function buildPagination(int $itemsCount): array
|
||||||
|
|
Loading…
Add table
Reference in a new issue