added stub publications by keywords component
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -9,18 +9,12 @@
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import {
|
||||
HttpClient,
|
||||
HttpHeaders,
|
||||
HttpParams,
|
||||
HttpResponse,
|
||||
HttpEvent,
|
||||
HttpParameterCodec,
|
||||
HttpContext,
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { AuthorWorkPage } from '../model/authorWorkPage';
|
||||
@@ -36,450 +30,364 @@ import { WorkSortBy } from '../model/workSortBy';
|
||||
import { WorkTopic } from '../model/workTopic';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WorksV2Service extends BaseService {
|
||||
constructor(
|
||||
protected httpClient: HttpClient,
|
||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||
@Optional() configuration?: Configuration,
|
||||
) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paginated list of works for a given author based on their ID.
|
||||
* @endpoint get /api/v2/works/{raw_oa_author_id}
|
||||
* @param rawOaAuthorId The raw OpenAlex author id.
|
||||
* @param page The page number to retrieve. (0-based)
|
||||
* @param size The number of works to retrieve per page.
|
||||
* @param publicationYears A list of publication years to filter by.
|
||||
* @param publicationTypes A list of publication types to filter by.
|
||||
* @param institutionIds A list of institution IDs to filter by.
|
||||
* @param topicIds A list of topic IDs to filter by.
|
||||
* @param languageCodes A list of language codes to filter by.
|
||||
* @param sortBy The field to sort by.
|
||||
* @param sortOrder The order to sort by.
|
||||
* @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 getAuthorWorkPage(
|
||||
rawOaAuthorId: string,
|
||||
page?: number,
|
||||
size?: number,
|
||||
publicationYears?: Array<number>,
|
||||
publicationTypes?: Array<string>,
|
||||
institutionIds?: Array<string>,
|
||||
topicIds?: Array<string>,
|
||||
languageCodes?: Array<string>,
|
||||
sortBy?: WorkSortBy,
|
||||
sortOrder?: SortDirection,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<AuthorWorkPage>;
|
||||
public getAuthorWorkPage(
|
||||
rawOaAuthorId: string,
|
||||
page?: number,
|
||||
size?: number,
|
||||
publicationYears?: Array<number>,
|
||||
publicationTypes?: Array<string>,
|
||||
institutionIds?: Array<string>,
|
||||
topicIds?: Array<string>,
|
||||
languageCodes?: Array<string>,
|
||||
sortBy?: WorkSortBy,
|
||||
sortOrder?: SortDirection,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<AuthorWorkPage>>;
|
||||
public getAuthorWorkPage(
|
||||
rawOaAuthorId: string,
|
||||
page?: number,
|
||||
size?: number,
|
||||
publicationYears?: Array<number>,
|
||||
publicationTypes?: Array<string>,
|
||||
institutionIds?: Array<string>,
|
||||
topicIds?: Array<string>,
|
||||
languageCodes?: Array<string>,
|
||||
sortBy?: WorkSortBy,
|
||||
sortOrder?: SortDirection,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<AuthorWorkPage>>;
|
||||
public getAuthorWorkPage(
|
||||
rawOaAuthorId: string,
|
||||
page?: number,
|
||||
size?: number,
|
||||
publicationYears?: Array<number>,
|
||||
publicationTypes?: Array<string>,
|
||||
institutionIds?: Array<string>,
|
||||
topicIds?: Array<string>,
|
||||
languageCodes?: Array<string>,
|
||||
sortBy?: WorkSortBy,
|
||||
sortOrder?: SortDirection,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter rawOaAuthorId was null or undefined when calling getAuthorWorkPage.',
|
||||
);
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>page,
|
||||
'page',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>size,
|
||||
'size',
|
||||
);
|
||||
if (publicationYears) {
|
||||
publicationYears.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'publication_years',
|
||||
/**
|
||||
* Returns a paginated list of works for a given author based on their ID.
|
||||
* @endpoint get /api/v2/works/{raw_oa_author_id}
|
||||
* @param rawOaAuthorId The raw OpenAlex author id.
|
||||
* @param page The page number to retrieve. (0-based)
|
||||
* @param size The number of works to retrieve per page.
|
||||
* @param publicationYears A list of publication years to filter by.
|
||||
* @param publicationTypes A list of publication types to filter by.
|
||||
* @param institutionIds A list of institution IDs to filter by.
|
||||
* @param topicIds A list of topic IDs to filter by.
|
||||
* @param languageCodes A list of language codes to filter by.
|
||||
* @param sortBy The field to sort by.
|
||||
* @param sortOrder The order to sort by.
|
||||
* @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 getAuthorWorkPage(rawOaAuthorId: string, page?: number, size?: number, publicationYears?: Array<number>, publicationTypes?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorWorkPage>;
|
||||
public getAuthorWorkPage(rawOaAuthorId: string, page?: number, size?: number, publicationYears?: Array<number>, publicationTypes?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorWorkPage>>;
|
||||
public getAuthorWorkPage(rawOaAuthorId: string, page?: number, size?: number, publicationYears?: Array<number>, publicationTypes?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorWorkPage>>;
|
||||
public getAuthorWorkPage(rawOaAuthorId: string, page?: number, size?: number, publicationYears?: Array<number>, publicationTypes?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||
throw new Error('Required parameter rawOaAuthorId was null or undefined when calling getAuthorWorkPage.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>size, 'size');
|
||||
if (publicationYears) {
|
||||
publicationYears.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_years');
|
||||
})
|
||||
}
|
||||
if (publicationTypes) {
|
||||
publicationTypes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_types');
|
||||
})
|
||||
}
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'institution_ids');
|
||||
})
|
||||
}
|
||||
if (topicIds) {
|
||||
topicIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic_ids');
|
||||
})
|
||||
}
|
||||
if (languageCodes) {
|
||||
languageCodes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'language_codes');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sort_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortOrder, 'sort_order');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/${this.configuration.encodeParam({name: "rawOaAuthorId", value: rawOaAuthorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorWorkPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
if (publicationTypes) {
|
||||
publicationTypes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'publication_types',
|
||||
|
||||
/**
|
||||
* Returns a list of institutions based on their IDs.
|
||||
* @endpoint get /api/v2/works/institutions/search
|
||||
* @param institutionIds A list of institution IDs to retrieve.
|
||||
* @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 getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<Institution>>;
|
||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<Institution>>>;
|
||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<Institution>>>;
|
||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'institution_ids');
|
||||
})
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/institutions/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<Institution>>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'institution_ids',
|
||||
|
||||
/**
|
||||
* Returns a list of work topics based on their IDs.
|
||||
* @endpoint get /api/v2/works/topics/search
|
||||
* @param topicIds A list of topic IDs to retrieve.
|
||||
* @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 getWorkTopicsByIds(topicIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<WorkTopic>>;
|
||||
public getWorkTopicsByIds(topicIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<WorkTopic>>>;
|
||||
public getWorkTopicsByIds(topicIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<WorkTopic>>>;
|
||||
public getWorkTopicsByIds(topicIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
if (topicIds) {
|
||||
topicIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic_ids');
|
||||
})
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/topics/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<WorkTopic>>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
if (topicIds) {
|
||||
topicIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'topic_ids',
|
||||
|
||||
/**
|
||||
* Search works by topics or raw keywords with filters.
|
||||
* @endpoint get /api/v2/works/keyword/search
|
||||
* @param topics List of topics to match.
|
||||
* @param topicIds List of topic IDs to match.
|
||||
* @param keywords Raw keywords to search in title/abstract.
|
||||
* @param fuzzy Use topic resolution if True, otherwise use raw keywords.
|
||||
* @param publicationYear A list of publication years to filter by.
|
||||
* @param publicationType A list of publication types to filter by.
|
||||
* @param institutionIds A list of institution IDs to filter by.
|
||||
* @param language A list of language codes to filter by.
|
||||
* @param page The page number to retrieve. (0-based)
|
||||
* @param size The number of works to retrieve per page.
|
||||
* @param sortBy The field to sort by.
|
||||
* @param sortOrder The order to sort by.
|
||||
* @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 getWorksByKeywords(topics?: Array<string>, topicIds?: Array<string>, keywords?: Array<string>, fuzzy?: boolean, publicationYear?: Array<number>, publicationType?: Array<string>, institutionIds?: Array<string>, language?: Array<string>, page?: number, size?: number, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorWorkPage>;
|
||||
public getWorksByKeywords(topics?: Array<string>, topicIds?: Array<string>, keywords?: Array<string>, fuzzy?: boolean, publicationYear?: Array<number>, publicationType?: Array<string>, institutionIds?: Array<string>, language?: Array<string>, page?: number, size?: number, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorWorkPage>>;
|
||||
public getWorksByKeywords(topics?: Array<string>, topicIds?: Array<string>, keywords?: Array<string>, fuzzy?: boolean, publicationYear?: Array<number>, publicationType?: Array<string>, institutionIds?: Array<string>, language?: Array<string>, page?: number, size?: number, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorWorkPage>>;
|
||||
public getWorksByKeywords(topics?: Array<string>, topicIds?: Array<string>, keywords?: Array<string>, fuzzy?: boolean, publicationYear?: Array<number>, publicationType?: Array<string>, institutionIds?: Array<string>, language?: Array<string>, page?: number, size?: number, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
if (topics) {
|
||||
topics.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topics');
|
||||
})
|
||||
}
|
||||
if (topicIds) {
|
||||
topicIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic_ids');
|
||||
})
|
||||
}
|
||||
if (keywords) {
|
||||
keywords.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'keywords');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>fuzzy, 'fuzzy');
|
||||
if (publicationYear) {
|
||||
publicationYear.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_year');
|
||||
})
|
||||
}
|
||||
if (publicationType) {
|
||||
publicationType.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_type');
|
||||
})
|
||||
}
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'institution_ids');
|
||||
})
|
||||
}
|
||||
if (language) {
|
||||
language.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'language');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>size, 'size');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sort_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortOrder, 'sort_order');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/keyword/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorWorkPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
if (languageCodes) {
|
||||
languageCodes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'language_codes',
|
||||
);
|
||||
});
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>sortBy,
|
||||
'sort_by',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>sortOrder,
|
||||
'sort_order',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorWorkPage>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of institutions based on their IDs.
|
||||
* @endpoint get /api/v2/works/institutions/search
|
||||
* @param institutionIds A list of institution IDs to retrieve.
|
||||
* @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 getInstitutionsByIds(
|
||||
institutionIds?: Array<string>,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<Institution>>;
|
||||
public getInstitutionsByIds(
|
||||
institutionIds?: Array<string>,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<Institution>>>;
|
||||
public getInstitutionsByIds(
|
||||
institutionIds?: Array<string>,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<Institution>>>;
|
||||
public getInstitutionsByIds(
|
||||
institutionIds?: Array<string>,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'institution_ids',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/institutions/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<Institution>>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of work topics based on their IDs.
|
||||
* @endpoint get /api/v2/works/topics/search
|
||||
* @param topicIds A list of topic IDs to retrieve.
|
||||
* @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 getWorkTopicsByIds(
|
||||
topicIds?: Array<string>,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<WorkTopic>>;
|
||||
public getWorkTopicsByIds(
|
||||
topicIds?: Array<string>,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<WorkTopic>>>;
|
||||
public getWorkTopicsByIds(
|
||||
topicIds?: Array<string>,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<WorkTopic>>>;
|
||||
public getWorkTopicsByIds(
|
||||
topicIds?: Array<string>,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
if (topicIds) {
|
||||
topicIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'topic_ids',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/v2/works/topics/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<WorkTopic>>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import { authorWorkPurposesResolver } from './resolvers/author-work-purposes.res
|
||||
import { workPageResolver } from './resolvers/work-page.resolver';
|
||||
import { selectedTopicsResolver } from './resolvers/selected-topics.resolver';
|
||||
import { selectedInstitutionsResolver } from './resolvers/selected-institutions.resolver';
|
||||
import { SearchResultsStateService } from './modules/keywords-search/search-results/search-results-state.service';
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
@@ -127,6 +128,7 @@ export const routes: Routes = [
|
||||
import('./modules/keywords-search/search-results/search-results.component').then(
|
||||
(mod) => mod.KeywordsSearchResultsComponent,
|
||||
),
|
||||
providers: [SearchResultsStateService],
|
||||
children: [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'persons' },
|
||||
{ path: 'persons', component: KeywordsToPersonsResultsComponent },
|
||||
|
||||
+29
-29
@@ -1,31 +1,31 @@
|
||||
<div class="result-layout">
|
||||
<mat-card class="results-card">
|
||||
<mat-card-content class="results-placeholder">
|
||||
<mat-icon>groups</mat-icon>
|
||||
<h2>Publikationsliste</h2>
|
||||
<p>
|
||||
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
|
||||
</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="weights-card">
|
||||
<mat-card-content>
|
||||
<app-weights-sliders
|
||||
[options]="weightOptions"
|
||||
[initialWeights]="defaultWeights"
|
||||
title="Publikations-Gewichtung"
|
||||
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
|
||||
resetLabel="Ausgewogen"
|
||||
applyLabel="Neu gewichten"
|
||||
normalizedTitle="Normalisiert"
|
||||
queryParamPrefix="workW_"
|
||||
[persistInQueryParams]="true"
|
||||
[showApplyButton]="true"
|
||||
[showResetButton]="true"
|
||||
[showNormalizedPreview]="true"
|
||||
(weightsChange)="onWeightsChange($event)"
|
||||
(applyWeights)="onApplyWeights($event)" />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@if (works() === null) {
|
||||
<app-loading
|
||||
text="Publikationsliste wird geladen..."
|
||||
icon="groups"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (works()?.elements?.length === 0) {
|
||||
<mat-card class="results-card">
|
||||
<mat-card-content class="results-placeholder">
|
||||
<mat-icon>groups</mat-icon>
|
||||
<span>Keine Publikationen gefunden.</span>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
} @else {
|
||||
<mat-card class="results-card">
|
||||
<mat-card-content class="results-placeholder">
|
||||
<app-data-table
|
||||
[columns]="workColumns"
|
||||
[data]="elements()"
|
||||
queryParamSortKey="sort_by"
|
||||
queryParamSortDirectionKey="sort_direction" />
|
||||
<app-query-param-paginator
|
||||
[total]="totalElements()"
|
||||
queryParamPageKey="page"
|
||||
queryParamSizeKey="size"
|
||||
[pageSizeOptions]="paginationService.options" />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
============================================================ */
|
||||
.result-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(300px, 420px) 1fr;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-areas: 'summary results';
|
||||
gap: 0.75rem;
|
||||
align-items: start;
|
||||
|
||||
+182
-53
@@ -1,31 +1,61 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
|
||||
import {
|
||||
Component,
|
||||
DestroyRef,
|
||||
OnInit,
|
||||
inject,
|
||||
signal,
|
||||
computed,
|
||||
} from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { WeightsSlidersComponent } from '../../../../shared/ui/weights-sliders/weights-sliders.component';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { DataTableComponent } from '../../../../shared/ui/data-table/data-table.component';
|
||||
import { LoadingComponent } from '../../../../shared/ui/loading/loading.component';
|
||||
import { GenericColumn } from '../../../../shared/ui/data-table/data-table.component';
|
||||
import { AuthorWork } from '../../../../api/model/authorWork';
|
||||
import { PaginationService } from '../../../../shared/services/pagination.service';
|
||||
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import {
|
||||
WeightMap,
|
||||
WeightSliderOption,
|
||||
WeightsSlidersComponent,
|
||||
WeightsSlidersValue,
|
||||
WeightMap,
|
||||
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
|
||||
import { viewChild, TemplateRef } from '@angular/core';
|
||||
import {
|
||||
AuthorWorkPage,
|
||||
SortDirection,
|
||||
WorkSortBy,
|
||||
WorksV2Service,
|
||||
} from '../../../../api';
|
||||
|
||||
import { SearchResultsStateService } from '../search-results-state.service';
|
||||
@Component({
|
||||
selector: 'app-works-results',
|
||||
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
|
||||
imports: [
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
//WeightsSlidersComponent,
|
||||
DataTableComponent,
|
||||
LoadingComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './works-results.component.html',
|
||||
styleUrl: './works-results.component.scss',
|
||||
})
|
||||
export class KeywordsToWorksResultsComponent {
|
||||
// injects the state set by the parent route — no duplicate parsing here
|
||||
export class KeywordsToWorksResultsComponent implements OnInit {
|
||||
private readonly state = inject(SearchResultsStateService);
|
||||
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly worksService = inject(WorksV2Service);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
public readonly paginationService = inject(PaginationService);
|
||||
readonly works = signal<AuthorWorkPage | null>(null);
|
||||
readonly defaultWeights: WeightMap = {
|
||||
param1: 0.33,
|
||||
param2: 0.33,
|
||||
param3: 0.34,
|
||||
};
|
||||
|
||||
readonly weightOptions: WeightSliderOption[] = [
|
||||
{
|
||||
key: 'param1',
|
||||
@@ -52,60 +82,159 @@ export class KeywordsToWorksResultsComponent {
|
||||
queryParamName: 'wParam3',
|
||||
},
|
||||
];
|
||||
|
||||
readonly currentWeights = signal<WeightsSlidersValue>({
|
||||
raw: this.defaultWeights,
|
||||
normalized: {
|
||||
param1: 0.33,
|
||||
param2: 0.33,
|
||||
param3: 0.34,
|
||||
},
|
||||
normalized: { param1: 0.33, param2: 0.33, param3: 0.34 },
|
||||
rawSum: 2.5,
|
||||
normalizedSum: 1,
|
||||
valid: true,
|
||||
});
|
||||
fuzzySearch = signal<boolean>(false);
|
||||
totalElements = computed(() => this.works()?.total ?? 0);
|
||||
elements = computed(() => this.works()?.elements ?? []);
|
||||
|
||||
readonly works = signal<unknown[]>([]); // placeholder until the results service lands
|
||||
workColumns: GenericColumn<AuthorWork>[] = [];
|
||||
titleTmp = viewChild.required<TemplateRef<any>>('titleTmp');
|
||||
typeTmp = viewChild.required<TemplateRef<any>>('typeTmp');
|
||||
yearTmp = viewChild.required<TemplateRef<any>>('yearTmp');
|
||||
languageTmp = viewChild.required<TemplateRef<any>>('languageTmp');
|
||||
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
|
||||
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
|
||||
citationsTmp = viewChild.required<TemplateRef<any>>('citationsTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
constructor() {
|
||||
this.route.queryParamMap
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe(() => {
|
||||
const fuzzy = this.route.snapshot.queryParamMap.get('fuzzy') === 'true';
|
||||
this.fuzzySearch.set(fuzzy);
|
||||
console.log('Query params changed, reloading works with fuzzy=', fuzzy);
|
||||
this.loadWorks();
|
||||
});
|
||||
}
|
||||
ngOnInit(): void {
|
||||
this.loadWorks();
|
||||
}
|
||||
ngAfterViewInit(): void {
|
||||
this.workColumns = [
|
||||
{
|
||||
id: 'title',
|
||||
header: 'Titel',
|
||||
type: 'accessor',
|
||||
accessorKey: 'title',
|
||||
},
|
||||
{
|
||||
id: 'type',
|
||||
header: 'Typ',
|
||||
type: 'accessor',
|
||||
accessorKey: 'type',
|
||||
},
|
||||
{
|
||||
id: 'publication_year',
|
||||
header: 'Jahr',
|
||||
type: 'accessor',
|
||||
accessorKey: 'publication_year',
|
||||
},
|
||||
{
|
||||
id: 'language',
|
||||
header: 'Sprache',
|
||||
type: 'display',
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
header: 'Institutionen',
|
||||
type: 'display',
|
||||
},
|
||||
{
|
||||
id: 'topics',
|
||||
header: 'Themen',
|
||||
type: 'display',
|
||||
},
|
||||
{
|
||||
id: 'cited_by_count',
|
||||
header: 'Zitiert von',
|
||||
type: 'accessor',
|
||||
accessorKey: 'cited_by_count',
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: 'Aktionen',
|
||||
type: 'display',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
private hasLoadedInitial = false;
|
||||
private loadWorks(): void {
|
||||
const payload = this.state.payload();
|
||||
|
||||
console.log('GOT PAYLOAD', payload);
|
||||
|
||||
const topicIds = this.state
|
||||
.selectedKeywordEntries()
|
||||
.map((entry) => entry.topic_mapping?.topic?.id)
|
||||
.filter((id): id is string => !!id);
|
||||
|
||||
console.log('GOT TOPIC IDS', topicIds);
|
||||
|
||||
if (topicIds.length === 0) {
|
||||
console.warn('No topic IDs available');
|
||||
return;
|
||||
}
|
||||
|
||||
const keywords = payload?.keywords ?? [];
|
||||
|
||||
const page = Number(this.route.snapshot.queryParamMap.get('page')) || 1;
|
||||
|
||||
const size = Number(this.route.snapshot.queryParamMap.get('size')) || 10;
|
||||
|
||||
const publicationYears = this.route.snapshot.queryParamMap
|
||||
.getAll('publicationYear')
|
||||
.map(Number)
|
||||
.filter((year) => !Number.isNaN(year));
|
||||
|
||||
const publicationTypes =
|
||||
this.route.snapshot.queryParamMap.getAll('publicationType');
|
||||
|
||||
const institutionIds = this.route.snapshot.queryParamMap.getAll(
|
||||
'publicationInstitutionId',
|
||||
);
|
||||
|
||||
const sortBy = (this.route.snapshot.queryParamMap.get('sort_by') ??
|
||||
'publication_year') as WorkSortBy;
|
||||
|
||||
const sortDirection = (this.route.snapshot.queryParamMap.get(
|
||||
'sort_direction',
|
||||
) ?? 'desc') as SortDirection;
|
||||
|
||||
this.worksService
|
||||
.getWorksByKeywords(
|
||||
[],
|
||||
topicIds,
|
||||
keywords,
|
||||
this.fuzzySearch(),
|
||||
publicationYears,
|
||||
publicationTypes,
|
||||
institutionIds,
|
||||
[],
|
||||
page,
|
||||
size,
|
||||
sortBy,
|
||||
sortDirection,
|
||||
)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe({
|
||||
next: (page) => {
|
||||
console.log('GOT WORKS PAGE', page);
|
||||
this.works.set(page);
|
||||
},
|
||||
error: (err) => console.error(err),
|
||||
});
|
||||
}
|
||||
onWeightsChange(value: WeightsSlidersValue): void {
|
||||
this.currentWeights.set(value);
|
||||
|
||||
// fires once with the query-param-aware initial state — use it to load
|
||||
if (!this.hasLoadedInitial) {
|
||||
this.hasLoadedInitial = true;
|
||||
this.loadworks();
|
||||
}
|
||||
}
|
||||
|
||||
} // fires once with the query-param-aware initial state — use it to load
|
||||
onApplyWeights(value: WeightsSlidersValue): void {
|
||||
this.currentWeights.set(value);
|
||||
this.loadworks();
|
||||
}
|
||||
|
||||
private loadworks(): void {
|
||||
const weights = this.currentWeights();
|
||||
|
||||
const requestPayload = {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
},
|
||||
};
|
||||
|
||||
console.log(requestPayload);
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* this.worksService.searchworks(requestPayload).subscribe({
|
||||
* next: results => this.works.set(results),
|
||||
* error: error => console.error(error),
|
||||
* });
|
||||
*/
|
||||
}
|
||||
this.loadWorks();
|
||||
} // reload works with the new weights applied
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user