1
0
Fork 1
mirror of https://example.com synced 2024-11-22 13:06:39 +09:00

perf (backend): improved post search with alt text

Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
sup39 2024-03-13 18:03:08 +09:00 committed by naskya
parent bc5f233b9a
commit e6e8aac224
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -98,20 +98,16 @@ export default define(meta, paramDef, async (ps, me) => {
if (ps.searchCwAndAlt) { if (ps.searchCwAndAlt) {
query.andWhere( query.andWhere(
new Brackets((qb) => { `"note"."id" IN (
qb.where("note.text &@~ :q", { q }) SELECT "id" FROM "note" WHERE "note"."text" &@~ :q
.orWhere("note.cw &@~ :q", { q }) UNION
.orWhere( SELECT "id" FROM "note" WHERE "note"."cw" &@~ :q
`EXISTS ( UNION
SELECT FROM "drive_file" SELECT "note_file"."noteId" FROM "note_file"
WHERE INNER JOIN "drive_file" ON "drive_file"."id" = "note_file"."fileId"
comment &@~ :q WHERE "drive_file"."comment" &@~ :q
AND )`,
drive_file."id" = ANY(note."fileIds") { q },
)`,
{ q },
);
}),
); );
} else { } else {
query.andWhere("note.text &@~ :q", { q }); query.andWhere("note.text &@~ :q", { q });