feat(search-results): enhance Fuzzy Search behavior and tooltip logic for improved user experience
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -22,9 +22,14 @@
|
||||
<span class="mode-badge">
|
||||
<mat-slide-toggle
|
||||
labelPosition="before"
|
||||
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."
|
||||
[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.'
|
||||
"
|
||||
(change)="onToggleFuzzySearch($event)"
|
||||
[checked]="state.fuzzySearch()">
|
||||
[checked]="state.fuzzySearch()"
|
||||
[disabled]="isPersonsTab()">
|
||||
Fuzzy Search
|
||||
</mat-slide-toggle>
|
||||
</span>
|
||||
@@ -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">
|
||||
|
||||
@@ -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<string>();
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user