openaire-library/searchPages/searchUtils/searchResult.component.ts

37 lines
1.2 KiB
TypeScript

import {Component, Input, OnInit} from '@angular/core';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Keyword} from "./highlight/highlight.component";
import {ResultPreview} from "../../utils/result-preview/result-preview";
@Component({
selector: 'search-result',
templateUrl: 'searchResult.component.html'
})
export class SearchResultComponent implements OnInit {
@Input() results: SearchResult[];
@Input() status: number;
@Input() type: string;
@Input() showLoading: boolean = false;
@Input() showSubjects: boolean = true;
@Input() showOrganizations: boolean = true;
@Input() custom_class: string = "search-results";
@Input() properties: EnvProperties;
constructor() {
}
ngOnInit() {}
public getResultPreview(result: SearchResult): ResultPreview {
return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
}
public quote(params: string): string {
return '"' + params + '"';
}
}