mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Fix: author search result without co-author
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<span *ngIf="dso.firstMetadataValue('dc.date.issued')" class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)
|
||||
</ng-container>
|
||||
<span *ngIf="dso.allMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" class="item-list-authors">
|
||||
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
|
||||
<span *ngFor="let author of allMetadataNoExcludingValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
|
||||
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
|
||||
<span *ngIf="!last">; </span>
|
||||
</span>
|
||||
|
@@ -47,6 +47,28 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
||||
return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all matching metadata string values from hitHighlights or dso metadata.
|
||||
*
|
||||
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||
* @returns {string[]} the matching string values or an empty array.
|
||||
*/
|
||||
allMetadataNoExcludingValues(keyOrKeys: string | string[]): string[] {
|
||||
let dsoMetadata: string[] = Metadata.allValues([this.dso.metadata], keyOrKeys);
|
||||
let highlights: string[] = Metadata.allValues([this.object.hitHighlights], keyOrKeys);
|
||||
let removedHighlights: string[] = highlights.map(str => str.replace(/<\/?em>/g, ''));
|
||||
for (let i = 0; i < removedHighlights.length; i++) {
|
||||
let index = dsoMetadata.indexOf(removedHighlights[i]);
|
||||
if (index !== -1) {
|
||||
dsoMetadata[index] = highlights[i];
|
||||
}
|
||||
}
|
||||
console.log(dsoMetadata);
|
||||
console.log(highlights);
|
||||
console.log(removedHighlights);
|
||||
return dsoMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights.
|
||||
*
|
||||
|
Reference in New Issue
Block a user