links search

This commit is contained in:
2025-04-07 22:08:12 +08:00
parent 694e005101
commit 0c4a67e769
2 changed files with 162 additions and 148 deletions

View File

@@ -18,10 +18,14 @@ export async function GET(request: NextRequest) {
const whereConditions = ['deleted_at IS NULL'];
if (search) {
// Expand search to include more fields: slug, shortUrl in attributes, team name, tag name, original_url
whereConditions.push(`(
title ILIKE '%${search}%' OR
slug ILIKE '%${search}%' OR
original_url ILIKE '%${search}%'
original_url ILIKE '%${search}%' OR
title ILIKE '%${search}%' OR
JSONHas(attributes, 'shortUrl') AND JSONExtractString(attributes, 'shortUrl') ILIKE '%${search}%' OR
arrayExists(x -> JSONExtractString(x, 'team_name') ILIKE '%${search}%', JSONExtractArrayRaw(teams)) OR
arrayExists(x -> JSONExtractString(x, 'tag_name') ILIKE '%${search}%', JSONExtractArrayRaw(tags))
)`);
}