From 87b283ccfb1b8766dc86105cbef02ba195352726 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 15 Aug 2026 12:40:03 +0200 Subject: [PATCH] feat(search-results): enhance Fuzzy Search behavior and tooltip logic for improved user experience --- .../search-results.component.html | 13 +++++++---- .../search-results.component.ts | 23 ++++++++++++++++++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/search-results/search-results.component.html b/webapp/src/app/modules/keywords-search/search-results/search-results.component.html index fcc5a94d..d242e9cd 100644 --- a/webapp/src/app/modules/keywords-search/search-results/search-results.component.html +++ b/webapp/src/app/modules/keywords-search/search-results/search-results.component.html @@ -22,9 +22,14 @@ + [checked]="state.fuzzySearch()" + [disabled]="isPersonsTab()"> Fuzzy Search @@ -72,8 +77,8 @@ [active]="rla.isActive" [queryParams]="{ keywords: state.payload()?.keywords?.join(','), - fuzzy: state.payload()?.options?.fuzzy, - topics: state.payload()?.options?.fuzzy ? state.topicIds() : null, + fuzzy: tabFuzzyValue(route), + topics: tabFuzzyValue(route) ? state.topicIds() : null, topicId: null, }" queryParamsHandling="replace"> diff --git a/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts b/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts index 76897874..d11c1216 100644 --- a/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts +++ b/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts @@ -63,6 +63,8 @@ export class KeywordsSearchResultsComponent { { path: 'trends', label: 'Visualisierung', icon: 'bar_chart' }, ]; + private readonly lastUserFuzzy = signal(false); + readonly selectedKeywordCount = computed(() => this.state.keywords().length); readonly allKeywordEntries = computed(() => { const seen = new Set(); @@ -85,7 +87,12 @@ export class KeywordsSearchResultsComponent { // previous search never gets silently applied to a new one. this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((params) => { const keywords = this.parseKeywordList(params.get('keywords')); - const fuzzySearch = params.get('fuzzy') === 'true'; + const onPersonsTab = this.isPersonsTab(); + const fuzzySearch = onPersonsTab || params.get('fuzzy') === 'true'; + + if (!onPersonsTab) { + this.lastUserFuzzy.set(params.get('fuzzy') === 'true'); + } const cached = this.readHandoffCache(); const cacheMatches = @@ -100,8 +107,22 @@ export class KeywordsSearchResultsComponent { ? cached!.patentKeywordEntries : undefined, }); + + if (onPersonsTab && params.get('fuzzy') !== 'true') { + this.updateQueryParams(true); + } }); } + + // the Fuzzy Search toggle is locked on while the Personen tab is active + isPersonsTab(): boolean { + return this.route.snapshot.firstChild?.routeConfig?.path === 'persons'; + } + + tabFuzzyValue(route: { path: string }): boolean { + if (route.path === 'persons') return true; + return this.lastUserFuzzy(); + } goBackToSearch(): void { void this.router.navigate(['/keywords'], { queryParamsHandling: 'merge',