From 30690b1cfb61d8d7799f8aa6f261dfc020c512be Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Wed, 8 Nov 2023 16:56:48 +0100 Subject: [PATCH] Add custom query to autocomplete options filter --- .../search-filter-autocomplete-chips.component.ts | 2 +- .../src/lib/search/models/autocomplete-option.interface.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.ts b/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.ts index a13747f2540..7b41ec64746 100644 --- a/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.ts +++ b/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.ts @@ -110,7 +110,7 @@ export class SearchFilterAutocompleteChipsComponent implements SearchWidget, OnI if (this.settings.field === AutocompleteField.CATEGORIES) { queryFragments = this.selectedOptions.map(val => `${this.settings.field}:"workspace://SpacesStore/${val.id}"`); } else { - queryFragments = this.selectedOptions.map(val => `${this.settings.field}:"${val.value}"`); + queryFragments = this.selectedOptions.map(val => val.query ?? `${this.settings.field}:"${val.value}"`); } this.context.queryFragments[this.id] = queryFragments.join(' OR '); this.context.update(); diff --git a/lib/content-services/src/lib/search/models/autocomplete-option.interface.ts b/lib/content-services/src/lib/search/models/autocomplete-option.interface.ts index a4fc71b5d8e..8171ebb152e 100644 --- a/lib/content-services/src/lib/search/models/autocomplete-option.interface.ts +++ b/lib/content-services/src/lib/search/models/autocomplete-option.interface.ts @@ -19,6 +19,7 @@ export interface AutocompleteOption { value: string; id?: string; fullPath?: string; + query?: string; } export enum AutocompleteField {