diff --git a/src/components/vs-input/vs-input.ts b/src/components/vs-input/vs-input.ts index 1b08792..af0351f 100644 --- a/src/components/vs-input/vs-input.ts +++ b/src/components/vs-input/vs-input.ts @@ -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; 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; diff --git a/src/constants.ts b/src/constants.ts index 1f87e03..f738883 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,19 +2,16 @@ // declare const EDGE_URL: string; declare const APP_URL: string; declare const VUE_APP_PORTAL: string; -declare const SOLR_HOST: string; -declare const SOLR_CORE: string; + // const _EDGE_URL = EDGE_URL; // const _POINT_URL = POINT_URL; const _APP_URL = APP_URL; const _VUE_APP_PORTAL = VUE_APP_PORTAL; -const _SOLR_HOST = SOLR_HOST; -const _SOLR_CORE = SOLR_CORE; + // export { _EDGE_URL as EDGE_URL }; // export { _POINT_URL as POINT_URL }; export { _APP_URL as APP_URL }; export { _VUE_APP_PORTAL as VUE_APP_PORTAL }; -export { _SOLR_HOST as SOLR_HOST }; -export { _SOLR_CORE as SOLR_CORE }; + diff --git a/src/models/solr.ts b/src/models/solr.ts index 3e87ca2..30d091b 100644 --- a/src/models/solr.ts +++ b/src/models/solr.ts @@ -1,8 +1,3 @@ -export interface SolrSettings { - core: string; - host: string; -} - export class ActiveFilterCategories { // count: number; // language!: Array; diff --git a/vue.config.js b/vue.config.js index c8ce3aa..b742416 100644 --- a/vue.config.js +++ b/vue.config.js @@ -85,8 +85,8 @@ module.exports = { new webpack.DefinePlugin({ APP_URL: JSON.stringify(process.env.APP_URL), VUE_APP_PORTAL: JSON.stringify(process.env.VUE_APP_PORTAL), - SOLR_HOST: JSON.stringify(process.env.SOLR_HOST), - SOLR_CORE: JSON.stringify(process.env.SOLR_CORE), + //SOLR_HOST: JSON.stringify(process.env.SOLR_HOST), + //SOLR_CORE: JSON.stringify(process.env.SOLR_CORE), }), new NodePolyfillPlugin(), ],