enable fuzzy search button

This commit is contained in:
Steven Tischer
2026-08-22 09:35:55 +02:00
parent 1ca3db5c78
commit 57d0daa21b
2 changed files with 6 additions and 31 deletions
@@ -22,14 +22,9 @@
<span class="mode-badge">
<mat-slide-toggle
labelPosition="before"
[matTooltip]="
isPersonsTab()
? 'Auf dem Personen-Tab wird immer nach Themen gerankt, daher ist Fuzzy Search hier fest aktiviert.'
: 'Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, man kann dann nach Themen filtern. Wenn deaktiviert, werden die Keywords direkt für die Suche verwendet.'
"
matTooltip="Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, man kann dann nach Themen filtern. Wenn deaktiviert, werden die Keywords direkt für die Suche verwendet."
(change)="onToggleFuzzySearch($event)"
[checked]="state.fuzzySearch()"
[disabled]="isPersonsTab()">
[checked]="state.fuzzySearch()">
Fuzzy Search
</mat-slide-toggle>
</span>
@@ -77,8 +72,8 @@
[active]="rla.isActive"
[queryParams]="{
keywords: state.payload()?.keywords?.join(','),
fuzzy: tabFuzzyValue(route),
topics: tabFuzzyValue(route) ? state.topicIds() : null,
fuzzy: state.payload()?.options?.fuzzy,
topics: state.payload()?.options?.fuzzy ? state.topicIds() : null,
topicId: null,
}"
queryParamsHandling="replace">
@@ -1,4 +1,4 @@
import { Component, computed, inject, signal } from '@angular/core';
import { Component, computed, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
ActivatedRoute,
@@ -76,8 +76,6 @@ export class KeywordsSearchResultsComponent {
{ path: 'trends', label: 'Visualisierung', icon: BAR_CHART_ICON },
];
private readonly lastUserFuzzy = signal(false);
readonly selectedKeywordCount = computed(() => this.state.keywords().length);
readonly allKeywordEntries = computed(() => {
const seen = new Set<string>();
@@ -100,12 +98,7 @@ 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 onPersonsTab = this.isPersonsTab();
const fuzzySearch = onPersonsTab || params.get('fuzzy') === 'true';
if (!onPersonsTab) {
this.lastUserFuzzy.set(params.get('fuzzy') === 'true');
}
const fuzzySearch = params.get('fuzzy') === 'true';
const cached = this.readHandoffCache();
const cacheMatches =
@@ -120,22 +113,9 @@ 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',