mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fix: author search result without co-author
(cherry picked from commit f055ff6fbd
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
3ab9f6a166
commit
4a608b1358
@@ -29,7 +29,7 @@
|
|||||||
<span *ngIf="dso.firstMetadataValue('dc.date.issued')" class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)
|
<span *ngIf="dso.firstMetadataValue('dc.date.issued')" class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<span *ngIf="dso.allMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" class="item-list-authors">
|
<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 [innerHTML]="author"><span [innerHTML]="author"></span></span>
|
||||||
<span *ngIf="!last">; </span>
|
<span *ngIf="!last">; </span>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -55,6 +55,28 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
|||||||
return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
|
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.
|
* Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user