- feature request: autocomplete search also on the start page and on the dataset detail page

This commit is contained in:
Arno Kaimbacher 2022-01-12 16:02:54 +01:00
parent 1239bb9df3
commit 3bd022bf54
10 changed files with 612 additions and 524 deletions

View file

@ -7,7 +7,7 @@ import ActiveFacetCategory from "@/components/active-facet-category/active-facet
import { SolrSettings } from "@/models/solr";
// import { DatasetService } from "@/services/dataset.service";
import DatasetService from "../../services/dataset.service";
import { Suggestion, Dataset } from "@/models/dataset";
import { Suggestion, Dataset, SearchType } from "@/models/dataset";
import { SolrResponse, FacetFields, FacetItem, FacetResults, FacetInstance } from "@/models/headers";
import { ActiveFilterCategories } from "@/models/solr";
@ -24,6 +24,9 @@ export default class SearchViewComponent extends Vue {
@Prop()
display!: string;
@Prop()
type!: string;
results: Array<Dataset> = [];
// facets: FacetFields = new FacetFields();
@ -68,10 +71,26 @@ export default class SearchViewComponent extends Vue {
return false;
}
}
// getKeyName(value: string) {
// return Object.entries(Suggestion).find(([key, val]) => val === value)?.[0];
// }
getEnumKeyByEnumValue<T extends { [index: string]: string }>(myEnum: T, enumValue: string): keyof T | null {
const keys = Object.keys(myEnum).filter((x) => myEnum[x] == enumValue);
return keys.length > 0 ? keys[0] : null;
// return keys[0];
}
beforeMount(): void {
// this.rdrAPI = new DatasetService();
if (this.display != undefined && this.display != "") {
if (this.display != "" && this.type != undefined) {
const enumKey = this.getEnumKeyByEnumValue(SearchType, this.type);
if (enumKey) {
const suggestion = new Suggestion(this.display, SearchType[enumKey]);
this.onSearch(suggestion);
} else {
this.onSearch(this.display);
}
} else if (this.display != "" && this.type == undefined) {
this.onSearch(this.display);
} else {
this.onSearch("");

View file

@ -126,9 +126,10 @@
<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 mobile-space">
<img src="@/assets/site/img/geosphere-austria-logo.jpg" class="pb-3" alt="logo geosphere austria" />
</div> -->
<a target="_blank" href="http://www.geologie.ac.at/">
<!-- <img src="@/assets/site/img/geosphere-austria-logo.jpg" class="pb-3" alt="logo geosphere austria" /> -->
<img src="@/assets/site/img/geologische-bundesanstalt-logo.jpg" alt="Geologische Bundesanstalt logo" />
</a>
<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" />