Compare commits

..

2 Commits

Author SHA1 Message Date
MAB
f4c6bdada5 request() 2023-10-18 10:45:31 +02:00
MAB
c994642e5a removed solr... 2023-10-18 10:39:58 +02:00
4 changed files with 27 additions and 22 deletions

View File

@ -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,25 @@ 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 searchUrl = 'https://tethysbackend/opensearch.xml'; //i would guess ?
const searchTerms = this.display;
const searchQuery = searchUrl.replace('{searchTerms}', searchTerms);
fetch(searchQuery)
.then((response) => response.text())
.then((xml) => {
// need XML parser library
const data = parseResponse(xml);
this.dataHandler(data);
})
.catch((error) => {
this.errorHandler(error);
})
.finally(() => {
this.loading = false;
});
}
private dataHandler(datasets: Dataset[]): void {
this.results = datasets;

View File

@ -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 };

View File

@ -1,8 +1,3 @@
export interface SolrSettings {
core: string;
host: string;
}
export class ActiveFilterCategories {
// count: number;
// language!: Array<string>;

View File

@ -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(),
],