mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-24 08:28:27 +03:00
Don't show completely unrelated chapter suggestions
Chapter suggestions should be at least slightly related to what the user has already typed. This change stops the server from sending suggestions that postgresql deems to be "less than 10% similar" Also modified tests to reflect this change.
This commit is contained in:
@@ -27,10 +27,11 @@ export async function getChapterNames(req: Request, res: Response): Promise<Resp
|
||||
FROM "videoInfo"
|
||||
WHERE "channelID" = ?
|
||||
) AND "description" != ''
|
||||
AND similarity("description", ?) >= 0.1
|
||||
GROUP BY "description"
|
||||
ORDER BY SUM("votes"), similarity("description", ?) DESC
|
||||
LIMIT 5;`
|
||||
, [channelID, description]) as { description: string }[];
|
||||
, [channelID, description, description]) as { description: string }[];
|
||||
|
||||
if (descriptions?.length > 0) {
|
||||
return res.status(200).json(descriptions.map(d => ({
|
||||
|
||||
Reference in New Issue
Block a user