mirror of
https://example.com
synced 2024-11-22 14:36:39 +09:00
perf (backend): improved post search with alt text
Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
parent
bc5f233b9a
commit
e6e8aac224
1 changed files with 10 additions and 14 deletions
|
@ -98,21 +98,17 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
|
||||
if (ps.searchCwAndAlt) {
|
||||
query.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where("note.text &@~ :q", { q })
|
||||
.orWhere("note.cw &@~ :q", { q })
|
||||
.orWhere(
|
||||
`EXISTS (
|
||||
SELECT FROM "drive_file"
|
||||
WHERE
|
||||
comment &@~ :q
|
||||
AND
|
||||
drive_file."id" = ANY(note."fileIds")
|
||||
`"note"."id" IN (
|
||||
SELECT "id" FROM "note" WHERE "note"."text" &@~ :q
|
||||
UNION
|
||||
SELECT "id" FROM "note" WHERE "note"."cw" &@~ :q
|
||||
UNION
|
||||
SELECT "note_file"."noteId" FROM "note_file"
|
||||
INNER JOIN "drive_file" ON "drive_file"."id" = "note_file"."fileId"
|
||||
WHERE "drive_file"."comment" &@~ :q
|
||||
)`,
|
||||
{ q },
|
||||
);
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
query.andWhere("note.text &@~ :q", { q });
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue