Merge branch 'tags-search' into 'main'

EventsDB: index badges in FTS

See merge request soapbox-pub/ditto!100
This commit is contained in:
Alex Gleason 2024-01-14 18:36:05 +00:00
commit d03343752e
1 changed files with 7 additions and 0 deletions

View File

@ -400,6 +400,8 @@ function buildSearchContent(event: Event): string {
return buildUserSearchContent(event as Event<0>); return buildUserSearchContent(event as Event<0>);
case 1: case 1:
return event.content; return event.content;
case 30009:
return buildTagsSearchContent(event.tags.filter(([t]) => t !== 'alt'));
default: default:
return ''; return '';
} }
@ -411,4 +413,9 @@ function buildUserSearchContent(event: Event<0>): string {
return [name, nip05, about].filter(Boolean).join('\n'); return [name, nip05, about].filter(Boolean).join('\n');
} }
/** Build search content from tag values. */
function buildTagsSearchContent(tags: string[][]): string {
return tags.map(([_tag, value]) => value).join('\n');
}
export { EventsDB }; export { EventsDB };