From 9cca801c800d4d37a5a1e41ff97d69ff6fdf7d22 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 11 Aug 2023 12:14:39 -0500 Subject: [PATCH] Order tag conditionals alphabetically, improve logic --- src/db/events.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/db/events.ts b/src/db/events.ts index 473f30a..641149c 100644 --- a/src/db/events.ts +++ b/src/db/events.ts @@ -7,11 +7,12 @@ type TagCondition = ({ event, count }: { event: SignedEvent; count: number }) => /** Conditions for when to index certain tags. */ const tagConditions: Record = { - 't': ({ count }) => count < 5, - 'p': ({ event }) => event.kind === 3, 'd': ({ event, count }) => 30000 <= event.kind && event.kind < 40000 && count === 0, - 'q': ({ event, count }) => event.kind === 1 && count === 0, + 'e': ({ count }) => count < 15, + 'p': ({ event, count }) => event.kind === 3 || count < 15, 'proxy': ({ count }) => count === 0, + 'q': ({ event, count }) => event.kind === 1 && count === 0, + 't': ({ count }) => count < 5, }; function insertEvent(event: SignedEvent): Promise {