1
0

update: using ILIKE instead of LIKE in search API

This commit is contained in:
alikia2x (寒寒) 2025-11-30 01:58:07 +08:00
parent a31257c441
commit 4008fabbf1
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 56209E0CCD8420C6

View File

@ -1,6 +1,6 @@
import { Elysia } from "elysia";
import { db, bilibiliMetadata, latestVideoSnapshot, songs } from "@core/drizzle";
import { eq, like } from "drizzle-orm";
import { eq, ilike } from "drizzle-orm";
import { BiliAPIVideoMetadataSchema, BiliVideoSchema, SongSchema } from "@backend/lib/schema";
import { z } from "zod";
import { getVideoInfo } from "@core/net/getVideoInfo";
@ -13,7 +13,7 @@ const getSongSearchResult = async (searchQuery: string) => {
.select()
.from(songs)
.innerJoin(latestVideoSnapshot, eq(songs.aid, latestVideoSnapshot.aid))
.where(like(songs.name, `%${searchQuery}%`));
.where(ilike(songs.name, `%${searchQuery}%`));
const results = data
.map((song) => {