fix: multiple tag queries
This commit is contained in:
parent
dbf2346176
commit
3153f632c7
@ -243,13 +243,15 @@ export class SqliteRelay extends EventEmitter<RelayHandlerEvents> implements Rel
|
||||
}
|
||||
let sql = `select ${resultType} from events`;
|
||||
const tags = Object.entries(req).filter(([k]) => k.startsWith("#"));
|
||||
let tx = 0;
|
||||
for (const [key, values] of tags) {
|
||||
const vArray = values as Array<string>;
|
||||
sql += ` inner join tags on events.id = tags.event_id and tags.key = ? and tags.value in (${this.#repeatParams(
|
||||
sql += ` inner join tags t_${tx} on events.id = t_${tx}.event_id and t_${tx}.key = ? and t_${tx}.value in (${this.#repeatParams(
|
||||
vArray.length,
|
||||
)})`;
|
||||
params.push(key.slice(1));
|
||||
params.push(...vArray);
|
||||
tx++;
|
||||
}
|
||||
if (req.search) {
|
||||
sql += " inner join search_content on search_content.id = events.id";
|
||||
|
Loading…
x
Reference in New Issue
Block a user