Index kind 1111 tags

This commit is contained in:
Alex Gleason 2025-06-01 14:45:29 -05:00
parent 293a0d10fb
commit 96799d1918
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -80,6 +80,10 @@ export class DittoPgStore extends NPostgres {
/** Conditions for when to index certain tags. */ /** Conditions for when to index certain tags. */
static tagConditions: Record<string, TagCondition> = { static tagConditions: Record<string, TagCondition> = {
'A': ({ count }) => count === 0,
'E': ({ count, value }) => count === 0 && isNostrId(value),
'K': ({ count, value }) => count === 0 && Number.isInteger(Number(value)),
'P': ({ count, value }) => count === 0 && isNostrId(value),
'a': ({ count }) => count < 15, 'a': ({ count }) => count < 15,
'client': ({ count, value }) => count === 0 && value.length < 50, 'client': ({ count, value }) => count === 0 && value.length < 50,
'd': ({ event, count }) => count === 0 && NKinds.parameterizedReplaceable(event.kind), 'd': ({ event, count }) => count === 0 && NKinds.parameterizedReplaceable(event.kind),
@ -88,7 +92,6 @@ export class DittoPgStore extends NPostgres {
'L': ({ event, count }) => event.kind === 1985 || count === 0, 'L': ({ event, count }) => event.kind === 1985 || count === 0,
'l': ({ event, count }) => event.kind === 1985 || count === 0, 'l': ({ event, count }) => event.kind === 1985 || count === 0,
'n': ({ count, value }) => count < 50 && value.length < 50, 'n': ({ count, value }) => count < 50 && value.length < 50,
'P': ({ count, value }) => count === 0 && isNostrId(value),
'p': DittoPgStore.pTagCondition, 'p': DittoPgStore.pTagCondition,
'proxy': ({ count, value }) => count === 0 && value.length < 256, 'proxy': ({ count, value }) => count === 0 && value.length < 256,
'q': ({ event, count, value }) => count === 0 && event.kind === 1 && isNostrId(value), 'q': ({ event, count, value }) => count === 0 && event.kind === 1 && isNostrId(value),