From 9d1ab1babb5135a1a6d3046147ffa96c0edb55d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sun, 21 Jun 2026 22:36:16 +0200 Subject: [PATCH 1/4] Added general purpose query param manipulating components for input, pagination, and selectors --- .../institutions/institutions.component.html | 45 +++------ .../institutions/institutions.component.scss | 4 - .../institutions/institutions.component.ts | 93 +++++-------------- .../query-param-input.component.html | 13 +++ .../query-param-input.component.scss | 0 .../query-param-input.component.ts | 63 +++++++++++++ .../query-param-paginator.component.html | 6 ++ .../query-param-paginator.component.scss | 3 + .../query-param-paginator.component.ts | 52 +++++++++++ .../query-param-selector.component.html | 5 + .../query-param-selector.component.scss | 10 ++ .../query-param-selector.component.ts | 46 +++++++++ 12 files changed, 232 insertions(+), 108 deletions(-) create mode 100644 webapp/src/app/shared/ui/query-param-input/query-param-input.component.html create mode 100644 webapp/src/app/shared/ui/query-param-input/query-param-input.component.scss create mode 100644 webapp/src/app/shared/ui/query-param-input/query-param-input.component.ts create mode 100644 webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.html create mode 100644 webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.scss create mode 100644 webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.ts create mode 100644 webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.html create mode 100644 webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.scss create mode 100644 webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.ts diff --git a/webapp/src/app/modules/institutions/institutions.component.html b/webapp/src/app/modules/institutions/institutions.component.html index 4702d7fe..ce12b7ed 100644 --- a/webapp/src/app/modules/institutions/institutions.component.html +++ b/webapp/src/app/modules/institutions/institutions.component.html @@ -4,34 +4,19 @@
- - Suche nach Namen - - search - - +
- + - +
@@ -106,11 +91,7 @@ - - + diff --git a/webapp/src/app/modules/institutions/institutions.component.scss b/webapp/src/app/modules/institutions/institutions.component.scss index 95ff7534..47a6389e 100644 --- a/webapp/src/app/modules/institutions/institutions.component.scss +++ b/webapp/src/app/modules/institutions/institutions.component.scss @@ -41,10 +41,6 @@ } } -mat-paginator { - background-color: var(--sg-background); -} - .card { padding: 0.5rem; background-color: var(--sg-background); diff --git a/webapp/src/app/modules/institutions/institutions.component.ts b/webapp/src/app/modules/institutions/institutions.component.ts index e2449349..18eea25f 100644 --- a/webapp/src/app/modules/institutions/institutions.component.ts +++ b/webapp/src/app/modules/institutions/institutions.component.ts @@ -1,26 +1,28 @@ -import { Component, effect, input, signal } from '@angular/core'; +import { Component, input } from '@angular/core'; import { Institution, InstitutionPage } from '../../api'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; -import { MatInputModule } from '@angular/material/input'; -import { ActivatedRoute, Router, RouterModule } from '@angular/router'; -import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { RouterModule } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; -import { DebounceDirective } from '../../directives/debounce.directive'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatDividerModule } from '@angular/material/divider'; +import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; +import { + QueryParamSelectorComponent, + SelectorOption, +} from '../../shared/ui/query-param-selector/query-param-selector.component'; +import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; @Component({ selector: 'app-institutions', imports: [ MatButtonModule, MatCardModule, - MatInputModule, MatIconModule, - DebounceDirective, - MatPaginator, MatDividerModule, RouterModule, + QueryParamPaginatorComponent, + QueryParamSelectorComponent, + QueryParamInputComponent, ], templateUrl: './institutions.component.html', styleUrl: './institutions.component.scss', @@ -28,74 +30,21 @@ import { MatDividerModule } from '@angular/material/divider'; export class InstitutionsComponent { institutionPage = input.required(); - urlSearchTerm = signal(''); - urlSortBy = signal('relevance'); - urlSortingOrder = signal('desc'); - - constructor( - private readonly activatedRoute: ActivatedRoute, - private readonly router: Router, - ) { - this.activatedRoute.queryParams - .pipe(takeUntilDestroyed()) - .subscribe((params) => { - this.urlSearchTerm.set(params['search'] || ''); - this.urlSortBy.set(params['sort_by'] || 'relevance'); - this.urlSortingOrder.set(params['sorting_order'] || 'desc'); - }); - - effect(() => { - const searchTerm = this.urlSearchTerm(); - this.router.navigate([], { - queryParams: { search: searchTerm }, - queryParamsHandling: 'merge', - }); - }); - } - - handleSearchTermChange(newTerm: string): void { - this.router.navigate([], { - queryParams: { search: newTerm }, - queryParamsHandling: 'merge', - }); - } - - clearSearchTerm(): void { - this.router.navigate([], { - queryParams: { search: null }, - queryParamsHandling: 'merge', - }); - } - - handlePageChange(event: PageEvent): void { - this.router.navigate([], { - queryParams: { page: event.pageIndex, size: event.pageSize }, - queryParamsHandling: 'merge', - }); - } + sortingOptions: SelectorOption[] = [ + { value: 'relevance', display_name: 'Relevanz' }, + { value: 'name', display_name: 'Name' }, + { value: 'works_count', display_name: 'Anzahl Publikationen' }, + { value: 'citations_count', display_name: 'Anzahl Zitationen' }, + ]; + sortingDirectionOptions: SelectorOption[] = [ + { value: 'asc', display_name: 'Aufsteigend' }, + { value: 'desc', display_name: 'Absteigend' }, + ]; extractInstitutionId(institution: Institution): string { return institution.id?.split('/').pop() ?? ''; } - handleSortFieldChange(event: Event): void { - const selectElement = event.target as HTMLSelectElement; - const sortField = selectElement.value; - this.router.navigate([], { - queryParams: { sort_by: sortField }, - queryParamsHandling: 'merge', - }); - } - - handleSortOrderChange(event: Event): void { - const selectElement = event.target as HTMLSelectElement; - const sortOrder = selectElement.value; - this.router.navigate([], { - queryParams: { sorting_order: sortOrder }, - queryParamsHandling: 'merge', - }); - } - getDisplayName(institution: Institution): string { const primary = institution.display_name?.trim(); if (primary && primary.length > 0) return primary; diff --git a/webapp/src/app/shared/ui/query-param-input/query-param-input.component.html b/webapp/src/app/shared/ui/query-param-input/query-param-input.component.html new file mode 100644 index 00000000..8ce973c0 --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-input/query-param-input.component.html @@ -0,0 +1,13 @@ + + {{ this.label() }} + + search + + diff --git a/webapp/src/app/shared/ui/query-param-input/query-param-input.component.scss b/webapp/src/app/shared/ui/query-param-input/query-param-input.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/app/shared/ui/query-param-input/query-param-input.component.ts b/webapp/src/app/shared/ui/query-param-input/query-param-input.component.ts new file mode 100644 index 00000000..85d396f1 --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-input/query-param-input.component.ts @@ -0,0 +1,63 @@ +import { Component, computed, inject, input, output } from '@angular/core'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { DebounceDirective } from '../../../directives/debounce.directive'; +import { MatInputModule } from '@angular/material/input'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { ActivatedRoute, Router } from '@angular/router'; +import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; +import { FormsModule } from '@angular/forms'; + +@Component({ + selector: 'app-query-param-input', + imports: [ + FormsModule, + MatInputModule, + MatButtonModule, + MatIconModule, + MatFormFieldModule, + DebounceDirective, + ], + templateUrl: './query-param-input.component.html', + styleUrl: './query-param-input.component.scss', +}) +export class QueryParamInputComponent { + queryParamKey = input.required(); + queryParamPageKey = input('page'); + label = input('Suchen'); + debounceTime = input(300); + handleValueChange = output(); + + private readonly activatedRouter = inject(ActivatedRoute); + private readonly router = inject(Router); + + private readonly queryParams = toSignal( + this.activatedRouter.queryParams.pipe(takeUntilDestroyed()), + ); + + _urlValue = computed(() => { + const params = this.queryParams(); + const key = this.queryParamKey(); + + return params && key ? params[key] || '' : ''; + }); + + clearInput(): void { + this.router.navigate([], { + queryParams: { [this.queryParamKey()]: null }, + queryParamsHandling: 'merge', + }); + } + + _handleValueChange(newValue: string): void { + this.handleValueChange?.emit(newValue); + + this.router.navigate([], { + queryParams: { + [this.queryParamKey()]: newValue || null, + [this.queryParamPageKey()]: 0, + }, + queryParamsHandling: 'merge', + }); + } +} diff --git a/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.html b/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.html new file mode 100644 index 00000000..ea5f4947 --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.html @@ -0,0 +1,6 @@ + diff --git a/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.scss b/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.scss new file mode 100644 index 00000000..bb582c94 --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.scss @@ -0,0 +1,3 @@ +mat-paginator { + background-color: var(--sg-background); +} diff --git a/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.ts b/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.ts new file mode 100644 index 00000000..63a0bd8f --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-paginator/query-param-paginator.component.ts @@ -0,0 +1,52 @@ +import { Component, computed, inject, input, output } from '@angular/core'; +import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; +import { MatPaginatorModule, PageEvent } from '@angular/material/paginator'; +import { ActivatedRoute, Router } from '@angular/router'; + +@Component({ + selector: 'app-query-param-paginator', + imports: [MatPaginatorModule], + templateUrl: './query-param-paginator.component.html', + styleUrl: './query-param-paginator.component.scss', +}) +export class QueryParamPaginatorComponent { + queryParamPageKey = input('page'); + queryParamSizeKey = input('size'); + pageSizeOptions = input([10, 25, 50]); + + total = input.required(); + + handlePageChange = output(); + + private readonly activatedRoute = inject(ActivatedRoute); + private readonly router = inject(Router); + + private readonly queryParams = toSignal( + this.activatedRoute.queryParams.pipe(takeUntilDestroyed()), + ); + + _urlPage = computed(() => { + const params = this.queryParams(); + const key = this.queryParamPageKey(); + + return params && key ? +params[key] || 0 : 0; + }); + + _urlSize = computed(() => { + const params = this.queryParams(); + const key = this.queryParamSizeKey(); + + return params && key ? +params[key] || 10 : 10; + }); + + _handlePageChange(event: PageEvent): void { + this.handlePageChange?.emit(event); + this.router.navigate([], { + queryParams: { + [this.queryParamPageKey()]: event.pageIndex || null, + [this.queryParamSizeKey()]: event.pageSize || null, + }, + queryParamsHandling: 'merge', + }); + } +} diff --git a/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.html b/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.html new file mode 100644 index 00000000..0f6dcd9b --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.html @@ -0,0 +1,5 @@ + diff --git a/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.scss b/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.scss new file mode 100644 index 00000000..d1990896 --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.scss @@ -0,0 +1,10 @@ +select { + padding: 0.75rem; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + font-size: 1rem; +} + +select:hover { + cursor: pointer; +} diff --git a/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.ts b/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.ts new file mode 100644 index 00000000..caa3f7bf --- /dev/null +++ b/webapp/src/app/shared/ui/query-param-selector/query-param-selector.component.ts @@ -0,0 +1,46 @@ +import { Component, computed, inject, input, output } from '@angular/core'; +import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; +import { FormsModule } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; + +export type SelectorOption = { + value: string; + display_name: string; +}; + +@Component({ + selector: 'app-query-param-selector', + imports: [FormsModule], + templateUrl: './query-param-selector.component.html', + styleUrl: './query-param-selector.component.scss', +}) +export class QueryParamSelectorComponent { + options = input.required(); + queryParamKey = input.required(); + handleSelectionChange = output(); + + private readonly activatedRoute = inject(ActivatedRoute); + private readonly router = inject(Router); + + private readonly queryParams = toSignal( + this.activatedRoute.queryParams.pipe(takeUntilDestroyed()), + ); + + _urlValue = computed(() => { + const params = this.queryParams(); + const key = this.queryParamKey(); + + return params && key ? params[key] || '' : ''; + }); + + _handleSelectionChange(event: Event): void { + const newValue = (event.target as HTMLSelectElement).value; + + this.router.navigate([], { + queryParams: { [this.queryParamKey()]: newValue }, + queryParamsHandling: 'merge', + }); + + this.handleSelectionChange.emit(event); + } +} From 70ed62a220377b7a5db4309b5da2155fbd38c176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sun, 21 Jun 2026 22:48:04 +0200 Subject: [PATCH 2/4] Updated projects to use query params components --- .../modules/projects/projects.component.html | 43 ++++------ .../modules/projects/projects.component.ts | 78 ++++--------------- 2 files changed, 30 insertions(+), 91 deletions(-) diff --git a/webapp/src/app/modules/projects/projects.component.html b/webapp/src/app/modules/projects/projects.component.html index 8d2a3884..0ae1e25c 100644 --- a/webapp/src/app/modules/projects/projects.component.html +++ b/webapp/src/app/modules/projects/projects.component.html @@ -4,19 +4,11 @@
- - Suche nach Namen - - search - - + +
- + - +
@@ -102,11 +91,7 @@ - - + diff --git a/webapp/src/app/modules/projects/projects.component.ts b/webapp/src/app/modules/projects/projects.component.ts index 4fc6f46d..effdc3f4 100644 --- a/webapp/src/app/modules/projects/projects.component.ts +++ b/webapp/src/app/modules/projects/projects.component.ts @@ -1,33 +1,34 @@ -import { Component, effect, input, signal } from '@angular/core'; +import { Component, input, signal } from '@angular/core'; import { FundingProject, FundingProjectPage, ProjectType } from '../../api'; import { MatDividerModule } from '@angular/material/divider'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { DebounceDirective } from '../../directives/debounce.directive'; import { MatIconModule } from '@angular/material/icon'; import { MatCardModule } from '@angular/material/card'; import { ActivatedRoute, Router, RouterModule } from '@angular/router'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { MatInputModule } from '@angular/material/input'; import { MatButtonModule } from '@angular/material/button'; import { DatePipe, UpperCasePipe } from '@angular/common'; import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; +import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; +import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; +import { + QueryParamSelectorComponent, + SelectorOption, +} from '../../shared/ui/query-param-selector/query-param-selector.component'; @Component({ selector: 'app-projects', imports: [ MatDividerModule, - MatFormFieldModule, - DebounceDirective, MatIconModule, MatCardModule, RouterModule, - MatPaginator, - MatInputModule, MatButtonModule, UpperCasePipe, DatePipe, MatChipsModule, + QueryParamInputComponent, + QueryParamPaginatorComponent, + QueryParamSelectorComponent, ], templateUrl: './projects.component.html', styleUrl: './projects.component.scss', @@ -35,11 +36,14 @@ import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; export class ProjectsComponent { fundingProjectPage = input.required(); - urlSearchTerm = signal(''); - urlSortBy = signal('relevance'); - urlSortingOrder = signal('desc'); urlChips = signal(['eu', 'bund', 'dfg']); + sortingOptions: SelectorOption[] = [{ value: 'title', display_name: 'Name' }]; + sortingDirectionOptions: SelectorOption[] = [ + { value: 'asc', display_name: 'Aufsteigend' }, + { value: 'desc', display_name: 'Absteigend' }, + ]; + constructor( private readonly activatedRoute: ActivatedRoute, private readonly router: Router, @@ -47,60 +51,10 @@ export class ProjectsComponent { this.activatedRoute.queryParams .pipe(takeUntilDestroyed()) .subscribe((params) => { - this.urlSearchTerm.set(params['search'] || ''); - this.urlSortBy.set(params['sort_by'] || 'relevance'); - this.urlSortingOrder.set(params['sorting_order'] || 'desc'); this.urlChips.set( (params['selected_project_types'] || 'eu,bund,dfg').split(','), ); }); - - effect(() => { - const searchTerm = this.urlSearchTerm(); - this.router.navigate([], { - queryParams: { search: searchTerm }, - queryParamsHandling: 'merge', - }); - }); - } - - handleSearchTermChange(newTerm: string): void { - this.router.navigate([], { - queryParams: { search: newTerm, page: 0, size: 10 }, - queryParamsHandling: 'merge', - }); - } - - clearSearchTerm(): void { - this.router.navigate([], { - queryParams: { search: null }, - queryParamsHandling: 'merge', - }); - } - - handlePageChange(event: PageEvent): void { - this.router.navigate([], { - queryParams: { page: event.pageIndex, size: event.pageSize }, - queryParamsHandling: 'merge', - }); - } - - handleSortFieldChange(event: Event): void { - const selectElement = event.target as HTMLSelectElement; - const sortField = selectElement.value; - this.router.navigate([], { - queryParams: { sort_by: sortField }, - queryParamsHandling: 'merge', - }); - } - - handleSortOrderChange(event: Event): void { - const selectElement = event.target as HTMLSelectElement; - const sortOrder = selectElement.value; - this.router.navigate([], { - queryParams: { sorting_order: sortOrder }, - queryParamsHandling: 'merge', - }); } handleChipBoxChange(change: MatChipListboxChange): void { From 0c2a45ba66a0b5fc939ff0ffe2f72ed689853d72 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 21 Jun 2026 23:36:15 +0200 Subject: [PATCH 3/4] Clean API key config --- service/src/main/inse/config.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/service/src/main/inse/config.py b/service/src/main/inse/config.py index 80335dab..ab247ce5 100644 --- a/service/src/main/inse/config.py +++ b/service/src/main/inse/config.py @@ -26,22 +26,18 @@ class Settings(BaseSettings): auth_disabled: bool = False auth_standalone: bool = True auth_secret: str = "change-me-to-a-secure-secret-key" - # OpenAlex works search config - openalex_works_search_base_url: str = "https://project.nes.uni-due.de/elastic" # IMPORTANT: wildcard * needed to query all work indices openalex_works_search_index: str = "openalex-works*" - openalex_works_api_key: str = ( - "am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==" - ) openalex_works_search_timeout_seconds: float = 30.0 # OpenAlex public API config openalex_api_base_url: str = "https://api.openalex.org" openalex_api_key: Optional[str] = None openalex_api_timeout_seconds: float = 30.0 - # Patent elasticsearch config + + # Patent Elasticsearch config patent_elasticsearch_url: str = "https://inse.nes.uni-due.de/elastic" - patent_elasticsearch_api_key: str = "" + patent_elasticsearch_api_key: Optional[str] = None # LLM config @@ -49,8 +45,8 @@ class Settings(BaseSettings): llm_api_key: Optional[str] = None llm_model: Optional[str] = None - # elasticsearch config - elasticsearch_url: Optional[str] = None + # Elasticsearch config + elasticsearch_url: str = "https://project.nes.uni-due.de/elastic" elasticsearch_api_key: Optional[str] = None elasticsearch_inse_url: Optional[str] = None elasticsearch_inse_api_key: Optional[str] = None @@ -63,9 +59,6 @@ class Settings(BaseSettings): {"url": "http://localhost:8000", "description": "Local development server"}, ] - elasticsearch_inse_url: Optional[str] = None - elasticsearch_inse_api_key: Optional[str] = None - logging_level: str = "DEBUG" From 514e572eb92be56879a89f2761e5688a9d9a4e42 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 21 Jun 2026 23:36:30 +0200 Subject: [PATCH 4/4] Use shared Elasticsearch config --- service/src/main/inse/company_connections/search_client.py | 5 ++--- service/src/main/inse/funders/elastic_search_client.py | 4 ++-- service/src/main/inse/works/search_client.py | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/service/src/main/inse/company_connections/search_client.py b/service/src/main/inse/company_connections/search_client.py index 80934c96..4516f4f7 100644 --- a/service/src/main/inse/company_connections/search_client.py +++ b/service/src/main/inse/company_connections/search_client.py @@ -22,14 +22,13 @@ class CompanyConnectionsSearchClient: self.base_url = ( base_url or config.settings.elasticsearch_url - or config.settings.openalex_works_search_base_url + or "" ).rstrip("/") self.api_key = ( api_key if api_key is not None else config.settings.elasticsearch_api_key - or config.settings.openalex_works_api_key - ) +) self.openalex_index = openalex_index self.handelsregister_index = handelsregister_index self.timeout = timeout diff --git a/service/src/main/inse/funders/elastic_search_client.py b/service/src/main/inse/funders/elastic_search_client.py index 126fa319..a411cb0a 100644 --- a/service/src/main/inse/funders/elastic_search_client.py +++ b/service/src/main/inse/funders/elastic_search_client.py @@ -23,9 +23,9 @@ class FundedPublicationsSearchClient: timeout: float | None = None, transport: httpx.AsyncBaseTransport | None = None, ): - self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/") + self.base_url = (base_url or config.settings.elasticsearch_url or "").rstrip("/") self.index = index or config.settings.openalex_works_search_index - self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key + self.api_key = api_key if api_key is not None else config.settings.elasticsearch_api_key self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds self.transport = transport diff --git a/service/src/main/inse/works/search_client.py b/service/src/main/inse/works/search_client.py index 36b1b3bb..fe60c665 100644 --- a/service/src/main/inse/works/search_client.py +++ b/service/src/main/inse/works/search_client.py @@ -26,12 +26,13 @@ class OpenAlexWorksSearchClient: timeout: float | None = None, transport: httpx.AsyncBaseTransport | None = None, ): - self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/") + self.base_url = (base_url or config.settings.elasticsearch_url or "").rstrip("/") self.index = index or config.settings.openalex_works_search_index - self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key + self.api_key = api_key if api_key is not None else config.settings.elasticsearch_api_key self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds self.transport = transport + def author_works_query( self, author_id: str,