From 5a9880e4e414bacc3630c759ed95190029e9adfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Fri, 5 Jan 2024 12:57:15 +0100 Subject: [PATCH] [BP] Search results / Configure related records type depending on template. (#7376) * Search results / Configure related records type depending on template. The search API provides the possibility to load related records for each hits. This allows to easily display them in search results but it also slow down a bit the search. Currently only the `list.html` template was displaying them based on the following configuration: ``` resultViewTpls: ... grid: { related: ["parent", "children", "services", "datasets"] }, ``` but user may want to customize this depending on the result template. This move the configuration to the `resultViewTpls` (and preserve previous mechanism) ``` resultViewTpls: ... { tplUrl: "../../catalog/components/" + "search/resultsview/partials/viewtemplates/list.html", tooltip: "List", icon: "fa-bars", related: ["parent", "children", "services", "datasets"] }, ``` so that user can more easily define which relations to load during search depending on the result template used. * Search / Optimize field based on current template Each search results templates display a specific set of fields. Add possibility to exclude unused fields from search to speed up search. At some point, it could be better to declare all required fields for rendering records on a per template basis on top of required fields needed for the JS app logic (eg. privileges, status, draft). * Batch edit / Properly init result template config. * Search / Optimize field based on current template / Add admin UI config. --- .../admin/uiconfig/partials/uiconfig.html | 25 +++++++++-- .../components/elasticsearch/EsFacet.js | 12 ++++- .../components/elasticsearch/EsService.js | 10 ++++- .../resultsview/ResultsviewDirective.js | 22 +++------- .../partials/templateswitcher.html | 4 +- .../searchmanager/SearchFormDirective.js | 44 +++++++++++++++---- .../viewer/owscontext/OwsContextDirective.js | 8 ++-- .../resources/catalog/js/CatController.js | 27 ++++++++++-- .../catalog/js/edit/BatchEditController.js | 2 +- .../catalog/js/edit/EditorBoardController.js | 2 +- .../catalog/js/search/SearchController.js | 2 +- .../resources/catalog/locales/en-admin.json | 5 +++ .../resources/catalog/views/default/module.js | 10 +++-- 13 files changed, 125 insertions(+), 48 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/admin/uiconfig/partials/uiconfig.html b/web-ui/src/main/resources/catalog/components/admin/uiconfig/partials/uiconfig.html index ee1f2c513f3..786d13aabfc 100644 --- a/web-ui/src/main/resources/catalog/components/admin/uiconfig/partials/uiconfig.html +++ b/web-ui/src/main/resources/catalog/components/admin/uiconfig/partials/uiconfig.html @@ -333,21 +333,27 @@

{{('ui-mod-' + m) | translate}}

- Icon + {{('ui-' + key + '-icon') | translate}} - Template URL + {{('ui-' + key + '-tplUrl') | translate}} - Tooltip + {{('ui-' + key + '-tooltip') | translate}} {{('ui-mod-' + m) | translate}} data-ng-model="opt.tooltip" />
+ +
+ + +
+
+ + +
@@ -17,7 +17,7 @@