From 2a9f178f5d222ce2a7bc24995c7390dfbc59355b Mon Sep 17 00:00:00 2001 From: Eric BREHAULT Date: Fri, 10 Jan 2025 12:03:11 +0100 Subject: [PATCH] Highlight option should not be forced to [sc-11389] --- libs/common/common.babel | 51 +++++++++++++++++++ libs/common/src/assets/i18n/ca.json | 2 + libs/common/src/assets/i18n/en.json | 2 + libs/common/src/assets/i18n/es.json | 2 + libs/common/src/assets/i18n/fr.json | 2 + .../search-box-form.component.html | 13 +++++ .../search-box-form.component.ts | 1 + .../lib/search-widget/search-widget.models.ts | 3 ++ 8 files changed, 76 insertions(+) diff --git a/libs/common/common.babel b/libs/common/common.babel index d66fb062c..dcc74d589 100644 --- a/libs/common/common.babel +++ b/libs/common/common.babel @@ -27492,6 +27492,57 @@ + + highlight + + + toggle-description + + + + + ca-ES + false + + + en-US + false + + + es-ES + false + + + fr-FR + false + + + + + toggle-label + + + + + ca-ES + false + + + en-US + false + + + es-ES + false + + + fr-FR + false + + + + + preselected-filters diff --git a/libs/common/src/assets/i18n/ca.json b/libs/common/src/assets/i18n/ca.json index 98ac44112..acf4c0010 100644 --- a/libs/common/src/assets/i18n/ca.json +++ b/libs/common/src/assets/i18n/ca.json @@ -1137,6 +1137,8 @@ "search.configuration.search-box.filters.filter-by-labels": "Filtrar per etiquetes", "search.configuration.search-box.filters.toggle-description": "L’usuari podrà aplicar filtres a la cerca.", "search.configuration.search-box.filters.toggle-label": "Mostra el botó per filtrar", + "search.configuration.search-box.highlight.toggle-description": "Ressaltar les paraules clau trobades.", + "search.configuration.search-box.highlight.toggle-label": "Ressaltar", "search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Afegeix expressió", "search.configuration.search-box.preselected-filters.assistant.add-filter": "Afegeix un filtre", "search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Esborra l’expressió", diff --git a/libs/common/src/assets/i18n/en.json b/libs/common/src/assets/i18n/en.json index d7db753c9..b9eddcb78 100644 --- a/libs/common/src/assets/i18n/en.json +++ b/libs/common/src/assets/i18n/en.json @@ -1137,6 +1137,8 @@ "search.configuration.search-box.filters.filter-by-labels": "Filter by labels", "search.configuration.search-box.filters.toggle-description": "The user will be able to apply filters to the search.", "search.configuration.search-box.filters.toggle-label": "Show button to filter", + "search.configuration.search-box.highlight.toggle-description": "Highlight matched keywords.", + "search.configuration.search-box.highlight.toggle-label": "Highlight", "search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Add expression", "search.configuration.search-box.preselected-filters.assistant.add-filter": "Add filter", "search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Delete expression", diff --git a/libs/common/src/assets/i18n/es.json b/libs/common/src/assets/i18n/es.json index 7dc9b920d..c478af085 100644 --- a/libs/common/src/assets/i18n/es.json +++ b/libs/common/src/assets/i18n/es.json @@ -1137,6 +1137,8 @@ "search.configuration.search-box.filters.filter-by-labels": "Filtrar per etiquetas", "search.configuration.search-box.filters.toggle-description": "El usuario podrá aplicar filtros a la búsqueda.", "search.configuration.search-box.filters.toggle-label": "Mostrar botón para filtrar", + "search.configuration.search-box.highlight.toggle-description": "Resaltar las palabras clave encontradas.", + "search.configuration.search-box.highlight.toggle-label": "Destacar", "search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Añadir expresión", "search.configuration.search-box.preselected-filters.assistant.add-filter": "Añadir filtro", "search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Eliminar expresión", diff --git a/libs/common/src/assets/i18n/fr.json b/libs/common/src/assets/i18n/fr.json index 7603ad9d5..fe0a06837 100644 --- a/libs/common/src/assets/i18n/fr.json +++ b/libs/common/src/assets/i18n/fr.json @@ -1137,6 +1137,8 @@ "search.configuration.search-box.filters.filter-by-labels": "Filtrer par étiquettes", "search.configuration.search-box.filters.toggle-description": "L’utilisateur pourra appliquer des filtres à la recherche.", "search.configuration.search-box.filters.toggle-label": "Afficher le bouton pour filtrer", + "search.configuration.search-box.highlight.toggle-description": "Mettre en évidence les mots-clés trouvés.", + "search.configuration.search-box.highlight.toggle-label": "Souligner", "search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Ajouter une expression", "search.configuration.search-box.preselected-filters.assistant.add-filter": "Ajouter un filtre", "search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Supprimer l’expression", diff --git a/libs/common/src/lib/search-widget/search-configuration/search-box-form/search-box-form.component.html b/libs/common/src/lib/search-widget/search-configuration/search-box-form/search-box-form.component.html index f27a5d225..65c8aa8e3 100644 --- a/libs/common/src/lib/search-widget/search-configuration/search-box-form/search-box-form.component.html +++ b/libs/common/src/lib/search-widget/search-configuration/search-box-form/search-box-form.component.html @@ -272,6 +272,19 @@ +
+ + + {{ 'search.configuration.search-box.highlight.toggle-label' | translate }} + + +
+ {{ 'search.configuration.search-box.highlight.toggle-description' | translate }} +
+
@if (synonymsEnabled | async) {
(false, { nonNullable: true }), preselectedFilters: new FormControl('', { nonNullable: true, updateOn: 'blur' }), useSynonyms: new FormControl(false, { nonNullable: true }), + highlight: new FormControl(false, { nonNullable: true }), prependTheQuery: new FormControl(false, { nonNullable: true }), queryPrepend: new FormControl('', { nonNullable: true, updateOn: 'blur' }), rephraseQuery: new FormControl(false, { nonNullable: true }), diff --git a/libs/common/src/lib/search-widget/search-widget.models.ts b/libs/common/src/lib/search-widget/search-widget.models.ts index c54c9e053..1ec93dd5c 100644 --- a/libs/common/src/lib/search-widget/search-widget.models.ts +++ b/libs/common/src/lib/search-widget/search-widget.models.ts @@ -19,6 +19,7 @@ export interface SearchBoxConfig { setPreselectedFilters: boolean; suggestions: boolean; useSynonyms: boolean; + highlight: boolean; suggestResults: boolean; autocompleteFromNERs: boolean; preselectedFilters: string; @@ -155,6 +156,7 @@ export const DEFAULT_SEARCH_BOX_CONFIG: SearchBoxConfig = { suggestResults: false, autocompleteFromNERs: false, useSynonyms: false, + highlight: false, prependTheQuery: false, queryPrepend: '', rephraseQuery: true, @@ -284,6 +286,7 @@ export function getFeatures(config: SearchConfiguration, widgetOptions: WidgetCo orFilterLogic: config.searchBox.filter && config.searchBox.filterLogic === 'or', autofilter: config.searchBox.autofilter, useSynonyms: config.searchBox.useSynonyms, + highlight: config.searchBox.highlight, suggestions: config.searchBox.suggestions, autocompleteFromNERs: config.searchBox.suggestions && config.searchBox.autocompleteFromNERs, showHidden: config.searchBox.showHiddenResources,