Skip to content

Commit 21ae750

Browse files
committed
fix(docs): truncate long search queries instead of dropping them
1 parent 5617e3d commit 21ae750

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎apps/docs/app/api/search/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function getSearchLimit(value: unknown): number {
3030
function getSearchParams(request: NextRequest) {
3131
const searchParams = request.nextUrl.searchParams
3232
return {
33-
query: searchParams.get('query') || searchParams.get('q') || '',
33+
query: (searchParams.get('query') || searchParams.get('q') || '').slice(0, MAX_QUERY_LENGTH),
3434
limit: getSearchLimit(searchParams.get('limit')),
3535
}
3636
}
@@ -40,7 +40,7 @@ export async function GET(request: NextRequest) {
4040
try {
4141
const { query, limit } = getSearchParams(request)
4242

43-
if (query.trim().length === 0 || query.length > MAX_QUERY_LENGTH) {
43+
if (query.trim().length === 0) {
4444
return NextResponse.json([])
4545
}
4646

0 commit comments

Comments
 (0)