Better deal with non-existing documents when searching

This commit is contained in:
jonaswinkler
2021-01-13 13:34:52 +01:00
parent 291983600b
commit 4bf4e3fb3e
3 changed files with 26 additions and 10 deletions

View File

@@ -28,7 +28,11 @@ export class SearchService {
}
return this.http.get<SearchResult>(`${environment.apiBaseUrl}search/`, {params: httpParams}).pipe(
map(result => {
result.results.forEach(hit => this.documentService.addObservablesToDocument(hit.document))
result.results.forEach(hit => {
if (hit.document) {
this.documentService.addObservablesToDocument(hit.document)
}
})
return result
})
)