Progress OpenSearch. Pending solving onFilter issue with active filters

This commit is contained in:
Porras-Bernardez 2024-06-13 17:01:14 +02:00
parent da430d6142
commit d135ab2d50
11 changed files with 109 additions and 82 deletions

View file

@ -20,6 +20,7 @@ export default class FacetCategory extends Vue {
filterName!: string;
get alias(): string {
console.log("filterName:", this.filterName);
return this.filterName == "datatype" ? "doctype" : this.filterName;
}
@ -53,6 +54,7 @@ export default class FacetCategory extends Vue {
@Emit("filter")
activateItem(filterItem: FacetItem): FacetItem {
// console.log(filterItem);
filterItem.category = this.alias;
filterItem.active = true;
// this.$emit("filter", filterItem);

View file

@ -8,6 +8,9 @@
<!-- e.g.language -->
<ul class="filter-items list-unstyled" v-bind:class="{ limited: facetItems.length > 1 && collapsed }">
<li v-for="(item, index) in facetItems" v-bind:key="index" class="list-group-item titlecase">
{{ item.active }}
{{ item.val }}
{{ item.count }} //
<!-- <span :class="item.Active ? 'disabled' : ''" @click.prevent="activateItem(item)">{{ item.val }} ({{ item.count }}) </span> -->
<span v-bind:class="item.active ? 'disabled' : ''" @click.prevent="activateItem(item)">{{ item.val }} ({{ item.count }}) </span>
</li>

View file

@ -210,7 +210,7 @@ export default class VsInput extends Vue {
// Handler for search input change
searchChanged(): void {
console.log("Search changed!");
// console.log("Search changed!");
this.selectedIndex = -1;
// Let's warn the parent that a change was made
// this.$emit("input", this.display);
@ -224,7 +224,7 @@ export default class VsInput extends Vue {
// Perform the search request
private resourceSearch() {
console.log("resourceSearch");
// console.log("resourceSearch");
if (!this.display) {
this.results = [];
return;
@ -252,14 +252,11 @@ export default class VsInput extends Vue {
this.highlights = highlights; // Store highlights
// console.log(datasets);
// this.$emit("search", this.display);
// this.loading = false;
}
// Handle errors from the search request
private errorHandler(err: string): void {
this.error = err;
// this.loading = false;
}
/**
@ -321,18 +318,14 @@ export default class VsInput extends Vue {
@Emit("search-change")
private select(obj: Suggestion): Suggestion {
// if (!obj) {
// return;
// }
console.log("select");
this.value = obj; //(obj["title_output"]) ? obj["title_output"] : obj.id
console.log("select:");
this.value = obj;
console.log(obj);
this.display = obj.value; // this.formatDisplay(obj)
// this.selectedDisplay = this.display;
this.display = obj.value;
this.close();
// this.$emit("update", this.value);
return this.value;
}
@ -355,12 +348,7 @@ export default class VsInput extends Vue {
if (!this.value) {
this.clear();
}
// if (this.selectedDisplay !== this.display && this.value) {
// this.display = this.selectedDisplay;
// }
this.results = [];
this.error = "";
//this.removeEventListener()
// this.$emit("close");
}
}

View file

@ -23,13 +23,15 @@ export default class VsResult extends Vue {
.join(".");
}
private convert(unixtimestamp: number): string {
// private convert(unixtimestamp: number): string { // SOLR
private convert(unixtimestamp: string): string { // OpenSearch
// Unixtimestamp
// var unixtimestamp = document.getElementById('timestamp').value;
// Months array
const months_arr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// Convert timestamp to milliseconds
const date = new Date(unixtimestamp * 1000);
// const date = new Date(unixtimestamp * 1000); // SOLR
const date = new Date(Number(unixtimestamp) * 1000); // OpenSearch
// Year
const year = date.getFullYear();
// Month

View file

@ -20,7 +20,8 @@
{{ convert(document.server_date_published) + ":&nbsp;" }}
</span>
<span class="text">
{{ document.abstract_output }}
<!-- {{ document.abstract_output }} -->
{{ document.abstract[0] }}
<span class="ellipsis">...</span>
<span class="fill"></span>
</span>