From 7f0b8367a2092c5ffd69e9e46d055cbd605c0e3a Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 28 Feb 2020 18:50:12 +0100 Subject: viewer: more minor architectural and performance improvement --- viewer/src/store/galleryStore.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'viewer/src/store') diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts index bc43ed2..4a5de0f 100644 --- a/viewer/src/store/galleryStore.ts +++ b/viewer/src/store/galleryStore.ts @@ -95,7 +95,15 @@ export default class GalleryStore extends VuexModule { // Indexes the gallery @action async indexTags() { const root = this.galleryIndex?.tree ?? null; - this.setTagsIndex(IndexFactory.generateTags(root)); + const index = IndexFactory.generateTags(root); + this.setTagsIndex(index); + return index; } + // Searches for tags + @action async search(filters: string[]) { + const results = filters.flatMap(filter => IndexFactory.searchTags(this.tagsIndex, filter, true)); + this.setCurrentSearch(results); + return results; + } } -- cgit v1.2.3