moved sorting logic to backend
This commit is contained in:
@@ -19,7 +19,7 @@ from inse.models.authors_list_response import AuthorsListResponse
|
||||
from inse import util
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.models.meta import Meta
|
||||
from inse.persons.query_builder import build_authors_search
|
||||
from inse.persons.query_builder import build_authors_search, build_authors_search_rescored
|
||||
from inse.persons.model import CustomAuthor, CustomAuthorsListResponse, PersonSearchRequest
|
||||
logger = logging.getLogger(__name__)
|
||||
INDEX_NAME="openalex-authors"
|
||||
@@ -122,30 +122,6 @@ def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsLi
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
|
||||
|
||||
def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse:
|
||||
body = {
|
||||
"_source":include.split(",") if include else True,
|
||||
}
|
||||
|
||||
try:
|
||||
hit = elasticsearch.get(
|
||||
index="openalex-authors",
|
||||
body=body,
|
||||
doc_id=author_id
|
||||
)
|
||||
except NotFoundError:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Person with id {author_id} not found"
|
||||
)
|
||||
|
||||
except ApiError as e:
|
||||
raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}")
|
||||
persons = [util.get_persons_data(hit)]
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
|
||||
def search_persons_by_name(
|
||||
author_name: str, limit: Optional[int] = 10, page_offset: Optional[int] = 0, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
@@ -358,6 +334,8 @@ def _enrich_author_data(author_data) -> Optional[CustomAuthor]:
|
||||
def advanced_search_persons(
|
||||
query: Optional[str] = None,
|
||||
institution_name: Optional[str] = None,
|
||||
sort_by: Optional[str] = None,
|
||||
sort_order: Optional[str] = None,
|
||||
topics: Optional[List[str]] = None,
|
||||
page: int = 1,
|
||||
page_size: int = 10,
|
||||
@@ -367,9 +345,11 @@ def advanced_search_persons(
|
||||
filter_year: Optional[int] = None,
|
||||
) -> CustomAuthorsListResponse:
|
||||
try:
|
||||
query_body = build_authors_search(
|
||||
query_body = build_authors_search_rescored(
|
||||
query=query,
|
||||
institution_name=institution_name,
|
||||
sort_by=sort_by,
|
||||
sort_order=sort_order,
|
||||
topics=topics,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
@@ -190,6 +190,12 @@ def search_persons_list(
|
||||
institution_name: Annotated[
|
||||
Optional[str], Query(alias="institutionName", description="Filter by institution name")
|
||||
] = None,
|
||||
sort_by: Annotated[
|
||||
Optional[str], Query(alias="sortBy", description="Value to sort by")
|
||||
] = None,
|
||||
sort_order: Annotated[
|
||||
Optional[str], Query(alias="sortOrder", description="asc or desc?")
|
||||
] = None,
|
||||
topic: Annotated[
|
||||
Optional[List[str]], Query(description="Filter by topic display names")
|
||||
] = None,
|
||||
@@ -224,6 +230,8 @@ def search_persons_list(
|
||||
return logic.advanced_search_persons(
|
||||
query=query,
|
||||
institution_name=institution_name,
|
||||
sort_by=sort_by,
|
||||
sort_order=sort_order,
|
||||
topics=topic,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
@@ -723,6 +723,8 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa
|
||||
* @endpoint get /api/inse-service/persons/search-list
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param institutionName Filter by institution name
|
||||
* @param sortBy Value to sort by
|
||||
* @param sortOrder asc or desc?
|
||||
* @param topic Filter by topic display names
|
||||
* @param page Page number (1-indexed)
|
||||
* @param pageSize Results per page
|
||||
@@ -733,16 +735,20 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>institutionName, 'institutionName');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sortBy');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortOrder, 'sortOrder');
|
||||
if (topic) {
|
||||
topic.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
@@ -808,6 +814,8 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa
|
||||
* @endpoint get /api/inse-service/persons/search-list
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param institutionName Filter by institution name
|
||||
* @param sortBy Value to sort by
|
||||
* @param sortOrder asc or desc?
|
||||
* @param topic Filter by topic display names
|
||||
* @param page Page number (1-indexed)
|
||||
* @param pageSize Results per page
|
||||
@@ -818,16 +826,20 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>institutionName, 'institutionName');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sortBy');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortOrder, 'sortOrder');
|
||||
if (topic) {
|
||||
topic.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
|
||||
@@ -130,6 +130,8 @@ export interface PersonsServiceInterface {
|
||||
* @endpoint get /api/inse-service/persons/search-list
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param institutionName Filter by institution name
|
||||
* @param sortBy Value to sort by
|
||||
* @param sortOrder asc or desc?
|
||||
* @param topic Filter by topic display names
|
||||
* @param page Page number (1-indexed)
|
||||
* @param pageSize Results per page
|
||||
@@ -138,7 +140,7 @@ export interface PersonsServiceInterface {
|
||||
* @param filterMode Filter mode: \'in\' or \'from\'
|
||||
* @param filterYear Filter year
|
||||
*/
|
||||
searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
|
||||
searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for persons with advanced filters (Topic & Institution) and pagination.
|
||||
@@ -146,6 +148,8 @@ export interface PersonsServiceInterface {
|
||||
* @endpoint get /api/inse-service/persons/search-list
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param institutionName Filter by institution name
|
||||
* @param sortBy Value to sort by
|
||||
* @param sortOrder asc or desc?
|
||||
* @param topic Filter by topic display names
|
||||
* @param page Page number (1-indexed)
|
||||
* @param pageSize Results per page
|
||||
@@ -154,6 +158,6 @@ export interface PersonsServiceInterface {
|
||||
* @param filterMode Filter mode: \'in\' or \'from\'
|
||||
* @param filterYear Filter year
|
||||
*/
|
||||
searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
|
||||
searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ export const routes: Routes = [
|
||||
'page',
|
||||
'pageSize',
|
||||
'institutionName',
|
||||
'sortBy',
|
||||
'sortOrder',
|
||||
'yearFilterEnabled',
|
||||
'filterMode',
|
||||
'filterYear',
|
||||
|
||||
@@ -50,10 +50,15 @@
|
||||
<div class="sort-selector">
|
||||
<span class="sort-label">Sortierung:</span>
|
||||
<div class="select-wrapper">
|
||||
<select [formControl]="sortControl">
|
||||
<option value="relevance">Beste Treffer (Relevanz)</option>
|
||||
<option value="works">Publikationen (absteigend)</option>
|
||||
<option value="citations">Zitierungen (absteigend)</option>
|
||||
<select [formControl]="sortValueControl">
|
||||
<option [ngValue]="null">Beste Treffer (Relevanz)</option>
|
||||
<option value="works_count">Publikationen</option>
|
||||
<option value="cited_by_count">Zitierungen</option>
|
||||
</select>
|
||||
|
||||
<select [formControl]="sortOrderControl">
|
||||
<option value="desc">Absteigend</option>
|
||||
<option value="asc">Aufsteigend</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,9 +71,9 @@
|
||||
<!--><span>Sortiert nach Publikationen und Zitierungen</span>-->
|
||||
</div>
|
||||
|
||||
@if (sortedPersons.length) {
|
||||
@if (getPersons().length) {
|
||||
<div class="person-grid">
|
||||
@for (person of sortedPersons; track person.id) {
|
||||
@for (person of getPersons(); track person.id) {
|
||||
<app-person-card [loading]="loading" [person]="person" [isBookmarked]="isBookmarked(person)"
|
||||
(bookmarkToggle)="toggleBookmark($event)" (topicClick)="onCardTopicClick($event)"
|
||||
(institutionClick)="onCardInstitutionClick($event)">
|
||||
|
||||
@@ -12,14 +12,30 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
|
||||
import { CustomAuthor, DehydratedInstitution, PersonsService, InstitutionsService } from '../../api';
|
||||
import {
|
||||
CustomAuthor,
|
||||
DehydratedInstitution,
|
||||
PersonsService,
|
||||
InstitutionsService,
|
||||
} from '../../api';
|
||||
import { TopicsService } from '../../api/api/topics.service';
|
||||
import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component';
|
||||
import { PersonCardComponent } from '../person-card/person-card.component';
|
||||
import { SharedStateService } from '../../shared/services/shared-state.service';
|
||||
import { PaginationService } from '../../shared/services/pagination.service';
|
||||
import { finalize, debounceTime, distinctUntilChanged, switchMap, map, of, catchError } from 'rxjs';
|
||||
import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import {
|
||||
finalize,
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
switchMap,
|
||||
map,
|
||||
of,
|
||||
catchError,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
MatAutocompleteModule,
|
||||
MatAutocompleteSelectedEvent,
|
||||
} from '@angular/material/autocomplete';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||
import {
|
||||
@@ -71,6 +87,8 @@ export class PersonListComponent {
|
||||
readonly institutionOptions = signal<any[]>([]);
|
||||
readonly institutionLookupLoading = signal<boolean>(false);
|
||||
|
||||
defaultOrderValue = 'desc';
|
||||
|
||||
// Selected filter states
|
||||
selectedTopics = new Set<string>();
|
||||
searchValue = signal<string | null>(null);
|
||||
@@ -82,7 +100,13 @@ export class PersonListComponent {
|
||||
appliedFilterYear = new Date().getFullYear() - 1;
|
||||
|
||||
// Forms
|
||||
sortControl = new FormControl('works', { nonNullable: true });
|
||||
sortValueControl = new FormControl(null, {
|
||||
nonNullable: true,
|
||||
});
|
||||
sortOrderControl = new FormControl(
|
||||
{ value: this.defaultOrderValue, disabled: this.isRelevanceSelected() },
|
||||
{ nonNullable: true },
|
||||
);
|
||||
topicSearchControl = new FormControl('', { nonNullable: true });
|
||||
institutionControl = new FormControl('', { nonNullable: true });
|
||||
yearFilterEnabledControl = new FormControl(false, { nonNullable: true });
|
||||
@@ -138,6 +162,8 @@ export class PersonListComponent {
|
||||
? Number.parseInt(params['pageSize'], 10)
|
||||
: 10;
|
||||
const institutionName = params['institutionName'] || '';
|
||||
const sortBy = params['sortBy'] || null
|
||||
const sortOrder = params['sortOrder'] || this.defaultOrderValue;
|
||||
const yearFilterEnabled = params['yearFilterEnabled'] === 'true';
|
||||
const filterMode =
|
||||
params['filterMode'] === 'in' || params['filterMode'] === 'from'
|
||||
@@ -149,16 +175,21 @@ export class PersonListComponent {
|
||||
|
||||
const topics = this.parseQueryParamArray(params['topic']);
|
||||
|
||||
// restore values from query params
|
||||
this.selectedTopics = new Set(topics);
|
||||
this.currentPage = page;
|
||||
this.paginationService.selection = pageSize;
|
||||
this.sortValueControl.setValue(sortBy);
|
||||
this.sortOrderControl.setValue(sortOrder);
|
||||
|
||||
// Sync search box & institution input
|
||||
if (this.searchValue() !== query) {
|
||||
this.searchValue.set(query || null);
|
||||
}
|
||||
if (this.institutionControl.value !== institutionName) {
|
||||
this.institutionControl.setValue(institutionName, { emitEvent: false });
|
||||
this.institutionControl.setValue(institutionName, {
|
||||
emitEvent: false,
|
||||
});
|
||||
this.updateYearFilterState(institutionName);
|
||||
}
|
||||
if (this.yearFilterEnabledControl.value !== yearFilterEnabled) {
|
||||
@@ -186,20 +217,24 @@ export class PersonListComponent {
|
||||
this.total = persons.meta?.count;
|
||||
this.loadingState.set(false);
|
||||
});
|
||||
// listen for sorting selectors changes
|
||||
this.sortValueControl.valueChanges.subscribe((value) => {
|
||||
if (!value) {
|
||||
this.sortOrderControl.setValue(this.defaultOrderValue)
|
||||
this.sortOrderControl.disable();
|
||||
} else {
|
||||
this.sortOrderControl.enable();
|
||||
}
|
||||
this.applySidebarFilters();
|
||||
});
|
||||
this.sortOrderControl.valueChanges.subscribe(() => {
|
||||
this.applySidebarFilters();
|
||||
});
|
||||
}
|
||||
|
||||
// Getters for filtered results
|
||||
get sortedPersons(): CustomAuthor[] {
|
||||
const sorted = [...this.persons];
|
||||
const val = this.sortControl.value;
|
||||
if (val === 'works') {
|
||||
return sorted.sort((a, b) => (b.works_count ?? 0) - (a.works_count ?? 0));
|
||||
} else if (val === 'citations') {
|
||||
return sorted.sort(
|
||||
(a, b) => (b.cited_by_count ?? 0) - (a.cited_by_count ?? 0),
|
||||
);
|
||||
}
|
||||
return sorted;
|
||||
getPersons(): CustomAuthor[] {
|
||||
return this.persons;
|
||||
}
|
||||
|
||||
get loading(): boolean {
|
||||
@@ -211,6 +246,10 @@ export class PersonListComponent {
|
||||
return this.selectedTopics.has(topic);
|
||||
}
|
||||
|
||||
isRelevanceSelected(): boolean {
|
||||
return !this.sortValueControl.value;
|
||||
}
|
||||
|
||||
toggleTopic(topic: string): void {
|
||||
if (this.selectedTopics.has(topic)) {
|
||||
this.selectedTopics.delete(topic);
|
||||
@@ -280,6 +319,8 @@ export class PersonListComponent {
|
||||
? Array.from(this.selectedTopics)
|
||||
: null,
|
||||
institutionName: this.institutionControl.value || null,
|
||||
sortBy: this.sortValueControl.value || null,
|
||||
sortOrder: this.sortOrderControl.value || null,
|
||||
yearFilterEnabled:
|
||||
this.institutionControl.value && this.yearFilterEnabledControl.value
|
||||
? 'true'
|
||||
@@ -317,8 +358,6 @@ export class PersonListComponent {
|
||||
return `${start}-${end} von ${this.total} Personen`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Bookmarks
|
||||
toggleBookmark(person: CustomAuthor): void {
|
||||
if (!person.id) return;
|
||||
@@ -353,12 +392,10 @@ export class PersonListComponent {
|
||||
this.searchValue.set(null);
|
||||
this.router.navigate([], {
|
||||
queryParams: { query: null, page: 1 },
|
||||
queryParamsHandling:"merge",
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private setupInstitutionAutocomplete(): void {
|
||||
this.institutionControl.valueChanges
|
||||
.pipe(
|
||||
@@ -386,7 +423,8 @@ export class PersonListComponent {
|
||||
}
|
||||
|
||||
private searchInstitutions(query: string) {
|
||||
return this.institutionsService.autocompleteInstitutions(query, undefined, undefined, 10)
|
||||
return this.institutionsService
|
||||
.autocompleteInstitutions(query, undefined, undefined, 10)
|
||||
.pipe(map((response) => response.results ?? []));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ export const personListResolver: ResolveFn<CustomAuthorsListResponse> = (
|
||||
: 10;
|
||||
|
||||
const institutionName = params.get('institutionName') || undefined;
|
||||
const sortBy= params.get('sortBy') || undefined;
|
||||
const sortOrder= params.get('sortOrder') || undefined;
|
||||
|
||||
const topicsParam = params.getAll('topic');
|
||||
|
||||
@@ -47,6 +49,8 @@ export const personListResolver: ResolveFn<CustomAuthorsListResponse> = (
|
||||
return personsService.searchPersonsList(
|
||||
query,
|
||||
institutionName,
|
||||
sortBy,
|
||||
sortOrder,
|
||||
topics,
|
||||
page,
|
||||
pageSize,
|
||||
|
||||
Reference in New Issue
Block a user