From 9ad4037c74e527e8f84919ab298a5bb8a745142f Mon Sep 17 00:00:00 2001 From: frankporras Date: Wed, 28 Aug 2024 10:29:03 +0200 Subject: [PATCH] Values for facet "language" changed to "English" and "Deutsch" --- .../ActiveFacetCategory.ts | 31 ++++++------- src/components/face-category/FacetCategory.ts | 45 ++++++++++++------- src/services/dataset.service.ts | 8 +++- .../search-view/search-view-component.vue | 20 --------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/components/active-facet-category/ActiveFacetCategory.ts b/src/components/active-facet-category/ActiveFacetCategory.ts index a1eed88..5e7b410 100644 --- a/src/components/active-facet-category/ActiveFacetCategory.ts +++ b/src/components/active-facet-category/ActiveFacetCategory.ts @@ -5,8 +5,7 @@ import { Component, Vue, Prop, Emit } from "vue-facing-decorator"; name: "ActiveFacetCategory", }) export default class ActiveFacetCategory extends Vue { - bar = ""; - + @Prop({ type: Array, }) @@ -18,6 +17,18 @@ export default class ActiveFacetCategory extends Vue { }) categoryName!: string; + + replacements = new Map([ + ["gis", "GIS"], + ["analysisdata", "Analysis Data"], + ["models", "Models"], + ["monitoring", "Monitoring"], + ["measurementdata", "Measurement Data"], + ["mixedtype", "Mixed Type"], + ["de", "Deutsch"], + ["en", "English"] + ]); + // @Prop([String]) // alias; @@ -47,18 +58,8 @@ export default class ActiveFacetCategory extends Vue { * NOTE: This could be corrected directly in the index */ filterItemsAlias(categoryAlias: string): string { - if (categoryAlias === "Data Type") { - // console.log("DataType"); - - const replacements = new Map([ - ["gis", "GIS"], - ["analysisdata", "Analysis Data"], - ["models", "Models"], - ["monitoring", "Monitoring"], - ["measurementdata", "Measurement Data"], - ["mixedtype", "Mixed Type"] - ]); - + console.log(categoryAlias); + if (categoryAlias === ("Data Type") || categoryAlias === ("language")) { /** * Iterate over the filterItems array using the map method to create a new array (updatedItems). * For each item in the array, check if the item exists as a key in the replacements map. @@ -67,7 +68,7 @@ export default class ActiveFacetCategory extends Vue { * The map method returns a new array where each element is either the original item or its replacement. * */ const updatedItems = this.filterItems.map((item) => - replacements.get(item) || item + this.replacements.get(item) || item ); return updatedItems.join(" | "); diff --git a/src/components/face-category/FacetCategory.ts b/src/components/face-category/FacetCategory.ts index af24c91..fe5c3ec 100644 --- a/src/components/face-category/FacetCategory.ts +++ b/src/components/face-category/FacetCategory.ts @@ -19,6 +19,17 @@ export default class FacetCategory extends Vue { }) filterName!: string; + replacements = new Map([ + ["gis", "GIS"], + ["analysisdata", "Analysis Data"], + ["models", "Models"], + ["monitoring", "Monitoring"], + ["measurementdata", "Measurement Data"], + ["mixedtype", "Mixed Type"], + ["de", "Deutsch"], + ["en", "English"] + ]); + /** * The alias for the Active facet box will be set depending on the name of the category. * This will allow to display the customised terms "creator" and "keyword" instead of the values currently used in the OpenSearch index: "author" and "subjects" @@ -48,22 +59,24 @@ export default class FacetCategory extends Vue { // console.log("filterName:", this.filterName); // return this.filterName == "datatype" ? "doctype" : this.filterName; - switch (val) { - case "gis": - return "GIS"; - case "analysisdata": - return "Analysis Data"; - case "models": - return "Models"; - case "monitoring": - return "Monitoring"; - case "measurementdata": - return "Measurement Data"; - case "mixedtype": - return "Mixed Type"; - default: - return val; - } + return this.replacements.get(val) || val; + + // switch (val) { + // case "gis": + // return "GIS"; + // case "analysisdata": + // return "Analysis Data"; + // case "models": + // return "Models"; + // case "monitoring": + // return "Monitoring"; + // case "measurementdata": + // return "Measurement Data"; + // case "mixedtype": + // return "Mixed Type"; + // default: + // return val; + // } } // get filterItems(): Array { diff --git a/src/services/dataset.service.ts b/src/services/dataset.service.ts index f94071d..a494fba 100644 --- a/src/services/dataset.service.ts +++ b/src/services/dataset.service.ts @@ -27,6 +27,8 @@ class DatasetService { // private openSearchUrl = "http://192.168.21.18/tethys-records/_search"; public searchTerm(term: string, openCore: string, openHost: string): Observable<{ datasets: Dataset[], highlights: HitHighlight[] }> { + // console.log("SEARCHTERM"); + // OpenSearch endpoint const host = openHost; // When using local OpenSearch dev endpoint const path = "/" + openCore + "/_search"; @@ -315,6 +317,8 @@ class DatasetService { openHost: string, start?: string, // Starting page ): Observable { + // console.log("FACETEDSEARCH"); + // OpenSearch endpoint const host = openHost; const path = "/" + openCore + "/_search"; @@ -432,7 +436,9 @@ class DatasetService { size: 10, from: start ? parseInt(start) : 0, - sort: [{ _score: { order: "desc" } }], + // sort: [{ _source: { server_date_published: { order: "desc" } } }], + sort: [{ server_date_published: { order: "desc" } }], + // sort: [{ _score: { order: "desc" } }], // Sort by _score in descending order track_scores: true, aggs: { // Defines aggregations for facets // terms: Aggregation type that returns the most common terms in a field. diff --git a/src/views/search-view/search-view-component.vue b/src/views/search-view/search-view-component.vue index 5c89d87..36d0e07 100644 --- a/src/views/search-view/search-view-component.vue +++ b/src/views/search-view/search-view-component.vue @@ -52,26 +52,6 @@ - -