1
|
import {Component, Input, OnInit} from '@angular/core';
|
2
|
import {SearchResult} from '../../utils/entities/searchResult';
|
3
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
4
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
5
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
6
|
import {Keyword} from "./highlight/highlight.component";
|
7
|
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
8
|
|
9
|
@Component({
|
10
|
selector: 'search-result',
|
11
|
templateUrl: 'searchResult.component.html'
|
12
|
})
|
13
|
export class SearchResultComponent implements OnInit {
|
14
|
@Input() results: SearchResult[];
|
15
|
@Input() status: number;
|
16
|
@Input() type: string;
|
17
|
@Input() showLoading: boolean = false;
|
18
|
@Input() showSubjects: boolean = true;
|
19
|
@Input() showOrganizations: boolean = true;
|
20
|
@Input() custom_class: string = "search-results";
|
21
|
@Input() properties: EnvProperties;
|
22
|
|
23
|
constructor() {
|
24
|
}
|
25
|
|
26
|
ngOnInit() {}
|
27
|
|
28
|
public getResultPreview(result: SearchResult): ResultPreview {
|
29
|
return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
|
30
|
}
|
31
|
|
32
|
|
33
|
public quote(params: string): string {
|
34
|
return '"' + params + '"';
|
35
|
}
|
36
|
}
|