forked from geolba/tethys.frontend
removed solr...
This commit is contained in:
parent
4ab1cd69b6
commit
c994642e5a
4 changed files with 29 additions and 22 deletions
|
@ -2,12 +2,12 @@
|
|||
// import debounce from 'lodash/debounce';
|
||||
// import { DatasetService } from "../../services/dataset.service";
|
||||
import DatasetService from "../../services/dataset.service";
|
||||
import { SolrSettings } from "@/models/solr";
|
||||
//import { SolrSettings } from "@/models/solr";
|
||||
// import { ref } from "vue";
|
||||
import { Component, Vue, Prop, Emit } from "vue-facing-decorator";
|
||||
// import { Prop, Emit } from "vue-property-decorator";
|
||||
import { Dataset, Suggestion, SearchType } from "@/models/dataset";
|
||||
import { SOLR_HOST, SOLR_CORE } from "@/constants";
|
||||
//import { SOLR_HOST, SOLR_CORE } from "@/constants";
|
||||
|
||||
@Component({
|
||||
name: "VsInput",
|
||||
|
@ -30,12 +30,12 @@ export default class VsInput extends Vue {
|
|||
private loading = false;
|
||||
private selectedIndex = -1;
|
||||
// private selectedDisplay = "";
|
||||
private solr: SolrSettings = {
|
||||
/*private solr: SolrSettings = {
|
||||
core: SOLR_CORE, //"rdr_data", // SOLR.core;
|
||||
host: SOLR_HOST, //"tethys.at",
|
||||
// core: "test_data", // SOLR.core;
|
||||
// host: "repository.geologie.ac.at",
|
||||
};
|
||||
};*/
|
||||
// private rdrAPI!: DatasetService;
|
||||
itemRefs!: Array<Element>;
|
||||
emits = ["filter"];
|
||||
|
@ -153,12 +153,27 @@ export default class VsInput extends Vue {
|
|||
}
|
||||
|
||||
private request(): void {
|
||||
DatasetService.searchTerm(this.display, this.solr.core, this.solr.host).subscribe({
|
||||
next: (res: Dataset[]) => this.dataHandler(res),
|
||||
error: (error: string) => this.errorHandler(error),
|
||||
complete: () => (this.loading = false),
|
||||
});
|
||||
const openSearchUrl = 'https://your-search-engine.com/opensearch.xml';
|
||||
const searchTerms = this.display;
|
||||
const openSearchQueryUrl = openSearchUrl.replace('{searchTerms}', searchTerms);
|
||||
|
||||
fetch(openSearchQueryUrl)
|
||||
.then((response) => response.text())
|
||||
.then((xml) => {
|
||||
// Parse the OpenSearch XML response (you may need to use an XML parser library)
|
||||
const data = parseResponse(xml); // Implement a function to parse the XML response
|
||||
|
||||
// Handle the data (e.g., update your Vue component's state with the search results)
|
||||
this.dataHandler(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.errorHandler(error);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private dataHandler(datasets: Dataset[]): void {
|
||||
this.results = datasets;
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue