Values for facet "language" changed to "English" and "Deutsch"

This commit is contained in:
Porras-Bernardez 2024-08-28 10:29:03 +02:00
parent 0126ae9f85
commit 9ad4037c74
4 changed files with 52 additions and 52 deletions

View File

@ -5,8 +5,7 @@ import { Component, Vue, Prop, Emit } from "vue-facing-decorator";
name: "ActiveFacetCategory", name: "ActiveFacetCategory",
}) })
export default class ActiveFacetCategory extends Vue { export default class ActiveFacetCategory extends Vue {
bar = "";
@Prop({ @Prop({
type: Array<string>, type: Array<string>,
}) })
@ -18,6 +17,18 @@ export default class ActiveFacetCategory extends Vue {
}) })
categoryName!: string; categoryName!: string;
replacements = new Map<string, string>([
["gis", "GIS"],
["analysisdata", "Analysis Data"],
["models", "Models"],
["monitoring", "Monitoring"],
["measurementdata", "Measurement Data"],
["mixedtype", "Mixed Type"],
["de", "Deutsch"],
["en", "English"]
]);
// @Prop([String]) // @Prop([String])
// alias; // alias;
@ -47,18 +58,8 @@ export default class ActiveFacetCategory extends Vue {
* NOTE: This could be corrected directly in the index * NOTE: This could be corrected directly in the index
*/ */
filterItemsAlias(categoryAlias: string): string { filterItemsAlias(categoryAlias: string): string {
if (categoryAlias === "Data Type") { console.log(categoryAlias);
// console.log("DataType"); if (categoryAlias === ("Data Type") || categoryAlias === ("language")) {
const replacements = new Map<string, string>([
["gis", "GIS"],
["analysisdata", "Analysis Data"],
["models", "Models"],
["monitoring", "Monitoring"],
["measurementdata", "Measurement Data"],
["mixedtype", "Mixed Type"]
]);
/** /**
* Iterate over the filterItems array using the map method to create a new array (updatedItems). * 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. * 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. * The map method returns a new array where each element is either the original item or its replacement.
* */ * */
const updatedItems = this.filterItems.map((item) => const updatedItems = this.filterItems.map((item) =>
replacements.get(item) || item this.replacements.get(item) || item
); );
return updatedItems.join(" | "); return updatedItems.join(" | ");

View File

@ -19,6 +19,17 @@ export default class FacetCategory extends Vue {
}) })
filterName!: string; filterName!: string;
replacements = new Map<string, string>([
["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. * 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" * 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); // console.log("filterName:", this.filterName);
// return this.filterName == "datatype" ? "doctype" : this.filterName; // return this.filterName == "datatype" ? "doctype" : this.filterName;
switch (val) { return this.replacements.get(val) || val;
case "gis":
return "GIS"; // switch (val) {
case "analysisdata": // case "gis":
return "Analysis Data"; // return "GIS";
case "models": // case "analysisdata":
return "Models"; // return "Analysis Data";
case "monitoring": // case "models":
return "Monitoring"; // return "Models";
case "measurementdata": // case "monitoring":
return "Measurement Data"; // return "Monitoring";
case "mixedtype": // case "measurementdata":
return "Mixed Type"; // return "Measurement Data";
default: // case "mixedtype":
return val; // return "Mixed Type";
} // default:
// return val;
// }
} }
// get filterItems(): Array<FilterItem> { // get filterItems(): Array<FilterItem> {

View File

@ -27,6 +27,8 @@ class DatasetService {
// private openSearchUrl = "http://192.168.21.18/tethys-records/_search"; // private openSearchUrl = "http://192.168.21.18/tethys-records/_search";
public searchTerm(term: string, openCore: string, openHost: string): Observable<{ datasets: Dataset[], highlights: HitHighlight[] }> { public searchTerm(term: string, openCore: string, openHost: string): Observable<{ datasets: Dataset[], highlights: HitHighlight[] }> {
// console.log("SEARCHTERM");
// OpenSearch endpoint // OpenSearch endpoint
const host = openHost; // When using local OpenSearch dev endpoint const host = openHost; // When using local OpenSearch dev endpoint
const path = "/" + openCore + "/_search"; const path = "/" + openCore + "/_search";
@ -315,6 +317,8 @@ class DatasetService {
openHost: string, openHost: string,
start?: string, // Starting page start?: string, // Starting page
): Observable<OpenSearchResponse> { ): Observable<OpenSearchResponse> {
// console.log("FACETEDSEARCH");
// OpenSearch endpoint // OpenSearch endpoint
const host = openHost; const host = openHost;
const path = "/" + openCore + "/_search"; const path = "/" + openCore + "/_search";
@ -432,7 +436,9 @@ class DatasetService {
size: 10, size: 10,
from: start ? parseInt(start) : 0, 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, track_scores: true,
aggs: { // Defines aggregations for facets aggs: { // Defines aggregations for facets
// terms: Aggregation type that returns the most common terms in a field. // terms: Aggregation type that returns the most common terms in a field.

View File

@ -52,26 +52,6 @@
<!-- <PaginationComponent v-bind:data="pagination"></PaginationComponent> --> <!-- <PaginationComponent v-bind:data="pagination"></PaginationComponent> -->
</div> </div>
<!-- <div class="container-fluid" style="padding-top: 3.8em">
<div class="columns is-mobile partner-logos">
<div class="column col-sm text-center">
<a target="_blank" href="https://www.re3data.org/repository/r3d100013400"
><img src="@/assets/site/img/re3-data-logo-mono.jpg" alt="re3 data logo"
/></a>
</div>
<div class="column col-sm text-center">
<a target="_blank" href="http://www.geosphere.at/">
<img src="@/assets/site/img/geosphere-austria-logo.jpg" alt="logo geosphere austria" />
</a>
</div>
<div class="column col-sm text-center">
<a target="_blank" href="https://www.base-search.net/Search/Results?q=coll:fttethysrdr&refid=dctablede">
<img src="@/assets/site/img/base-logo.gif" alt="logo base" />
</a>
</div>
</div>
</div> -->
<div class="container-fluid"> <div class="container-fluid">
<!-- <div class="columns is-mobile partner-logos"> --> <!-- <div class="columns is-mobile partner-logos"> -->
<div class="columns"> <div class="columns">