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:
parent
bc5f233b9a
commit
e6e8aac224
1 changed files with 10 additions and 14 deletions
|
@ -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 });
|
||||||
|
|
Loading…
Reference in a new issue