OpenSearch - some progress in migration

This commit is contained in:
Porras-Bernardez 2024-06-06 17:11:54 +02:00
parent a853e93b68
commit 6d1c1b28c3
5 changed files with 143 additions and 137 deletions

View file

@ -88,7 +88,9 @@ export default class VsInput extends Vue {
// };
const suggestions = new Array<Suggestion>();
console.log("Display:", this.display);
console.log("Display:", this.display);
// console.log("results:", this.results );
this.results.forEach((dataset) => {
@ -106,23 +108,23 @@ export default class VsInput extends Vue {
suggestions.push(suggestion);
}
}
if (this.find(dataset.author, this.display.toLowerCase()) !== "") {
const author = this.find(dataset.author, this.display.toLowerCase());
// if (this.find(dataset.author, this.display.toLowerCase()) !== "") {
// const author = this.find(dataset.author, this.display.toLowerCase());
const hasAuthorSuggestion = suggestions.some((suggestion) => suggestion.value === author && suggestion.type == SearchType.Author);
if (!hasAuthorSuggestion) {
const suggestion = new Suggestion(author, SearchType.Author);
suggestions.push(suggestion);
}
}
if (this.find(dataset.subject, this.display.toLowerCase()) != "") {
const subject = this.find(dataset.subject, this.display.toLowerCase());
const hasSubjectSuggestion = suggestions.some((suggestion) => suggestion.value === subject && suggestion.type == SearchType.Subject);
if (!hasSubjectSuggestion) {
const suggestion = new Suggestion(subject, SearchType.Subject);
suggestions.push(suggestion);
}
}
// const hasAuthorSuggestion = suggestions.some((suggestion) => suggestion.value === author && suggestion.type == SearchType.Author);
// if (!hasAuthorSuggestion) {
// const suggestion = new Suggestion(author, SearchType.Author);
// suggestions.push(suggestion);
// }
// }
// if (this.find(dataset.subject, this.display.toLowerCase()) != "") {
// const subject = this.find(dataset.subject, this.display.toLowerCase());
// const hasSubjectSuggestion = suggestions.some((suggestion) => suggestion.value === subject && suggestion.type == SearchType.Subject);
// if (!hasSubjectSuggestion) {
// const suggestion = new Suggestion(subject, SearchType.Subject);
// suggestions.push(suggestion);
// }
// }
});
return suggestions;
@ -174,7 +176,8 @@ export default class VsInput extends Vue {
private request(): void {
console.log("request()");
DatasetService.searchTerm(this.display, this.solr.core, this.solr.host).subscribe({
// DatasetService.searchTerm(this.display, this.solr.core, this.solr.host).subscribe({
DatasetService.searchTerm(this.display).subscribe({
next: (res: Dataset[]) => this.dataHandler(res),
error: (error: string) => this.errorHandler(error),
complete: () => (this.loading = false),