From 16b129b9f6a09ea4b5baa152f5d26ac367622c2b Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 30 May 2026 10:59:14 +0200 Subject: [PATCH 1/4] fix(backend/search): enhance search functionality for persons by adding match_phrase_prefix query --- service/src/main/inse/logic.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 1ca95754..42c32923 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -366,6 +366,14 @@ def search_persons_by_name(author_name: str, limit: Optional[int] = 10) -> model } } }, + { + "match_phrase_prefix": { + "display_name": { + "query": author_name, + "boost": 3 + } + } + }, { "match": { "display_name": { From eba62aa56821d993619b7fcb5ab8ed867db92a05 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 30 May 2026 11:01:34 +0200 Subject: [PATCH 2/4] feat(frontend/person-list): add result count display for persons in the list --- .../src/app/modules/person-list/person-list.component.html | 4 ++++ .../src/app/modules/person-list/person-list.component.scss | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 221648c9..082e7a10 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -1,3 +1,7 @@ +@if (!isPersonsLoading && state.persons().length > 0) { +

{{ state.persons().length }} Ergebnisse

+} + @if (!isPersonsLoading){ @for (person of state.persons(); track person.id) { diff --git a/webapp/src/app/modules/person-list/person-list.component.scss b/webapp/src/app/modules/person-list/person-list.component.scss index e12337d7..4576a32a 100644 --- a/webapp/src/app/modules/person-list/person-list.component.scss +++ b/webapp/src/app/modules/person-list/person-list.component.scss @@ -1,3 +1,9 @@ +.result-count { + margin: 0 0 12px; + font-size: 14px; + color: #666; +} + .person-card { width: 100%; height: 100%; From 4415683874987ac843b1f7911ccc41f339918f7c Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 30 May 2026 11:16:01 +0200 Subject: [PATCH 3/4] feat(frontend/person-list): add distinguishing ID display for persons --- .../modules/person-list/person-list.component.html | 1 + .../modules/person-list/person-list.component.scss | 6 ++++++ .../app/modules/person-list/person-list.component.ts | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 082e7a10..820c062b 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -18,6 +18,7 @@

{{ person.name }}

+

{{ getDistinguishingId(person) }}

@if (person.affiliations!=undefined){

{{ person.affiliations[0]?.institution }} diff --git a/webapp/src/app/modules/person-list/person-list.component.scss b/webapp/src/app/modules/person-list/person-list.component.scss index 4576a32a..10174b2e 100644 --- a/webapp/src/app/modules/person-list/person-list.component.scss +++ b/webapp/src/app/modules/person-list/person-list.component.scss @@ -41,6 +41,12 @@ margin: 0; } +.person-id { + font-size: 11px; + color: #aaa; + margin: 0; +} + .affiliation { color: #666; margin: 0; diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index 8a69628f..f78ef450 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -71,5 +71,14 @@ export class PersonListComponent implements OnInit{ console.log(id) this.router.navigate(['/persons',id]); } - + + // if a person has an ORCID, use it as the distinguishing ID, otherwise use the regular ID + getDistinguishingId(person: Person): string { + const ids = person.ids as { orcid?: string } | null | undefined; + const orcid = ids?.orcid; + if (orcid) { + return 'ORCID: ' + orcid.replace('https://orcid.org/', ''); + } + return 'OpenAlexID: ' + person.id; + } } From b67c6673764cac1a6cb7e7de9cc0f5a0b1cda501 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 30 May 2026 11:26:05 +0200 Subject: [PATCH 4/4] feat(person-list): implement sorting of persons by ranking based on institution and ORCID presence --- .../person-list/person-list.component.ts | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index f78ef450..38469f7a 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -43,7 +43,7 @@ export class PersonListComponent implements OnInit{ this.personsService.searchPersonsByName(author_name).subscribe({ next: (result) => { - this.state.persons.set(result.persons ?? []); + this.state.persons.set(this.sortByRanking(result.persons ?? [])); this.state.hasSearched.set(true); this.isPersonsLoading = false }, @@ -72,6 +72,57 @@ export class PersonListComponent implements OnInit{ this.router.navigate(['/persons',id]); } + sortByRanking(persons: Person[]): Person[] { + const personsByRank = new Map(); + + for (const person of persons) { + const rank = this.getSortRank(person); + if (!personsByRank.has(rank)) { + personsByRank.set(rank, []); + } + personsByRank.get(rank)!.push(person); + } + + const sortedRanks = Array.from(personsByRank.keys()).sort((a, b) => a - b); + const sortedPersons: Person[] = []; + + for (const rank of sortedRanks) { + sortedPersons.push(...personsByRank.get(rank)!); + } + + return sortedPersons; + } + + getSortRank(person: Person): number { + if (this.hasInstitution(person) && this.hasOrcid(person)) { + return 0; + } + if (this.hasInstitution(person)) { + return 1; + } + if (this.hasOrcid(person)) { + return 2; + } + return 3; + } + + hasInstitution(person: Person): boolean { + if (!person.affiliations) { + return false; + } + for (const affiliation of person.affiliations) { + if (affiliation.institution) { + return true; + } + } + return false; + } + + hasOrcid(person: Person): boolean { + const ids = person.ids as { orcid?: string } | null | undefined; + return !!ids?.orcid; + } + // if a person has an ORCID, use it as the distinguishing ID, otherwise use the regular ID getDistinguishingId(person: Person): string { const ids = person.ids as { orcid?: string } | null | undefined;