From b3fffc25804e90a97b0106cb1d49d298880095b1 Mon Sep 17 00:00:00 2001 From: Viktor Bozhinov Date: Fri, 10 Feb 2023 16:07:14 +0000 Subject: [PATCH] add scoring related values to config #398 BREAKING CHANGE: add scoring related values to config --- datagateway_api/config.yaml.example | 10 ++++++---- datagateway_api/src/common/config.py | 13 +++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/datagateway_api/config.yaml.example b/datagateway_api/config.yaml.example index 1a7fdd9e..5224f796 100644 --- a/datagateway_api/config.yaml.example +++ b/datagateway_api/config.yaml.example @@ -15,10 +15,12 @@ search_api: mechanism: "anon" username: "" password: "" - scoring_enabled: false - scoring_server: "http://localhost:9000/score" - scoring_group: "investigation" #corresponds to the defined group in the scoring app. https://github.com/panosc-eu/panosc-search-scoring/blob/master/docs/md/PaNOSC_Federated_Search_Results_Scoring_API.md#model - scoring_limit: 1000 + search_scoring: + enabled: false + api_url: "http://localhost:9000/score" + api_request_timeout: 5 + group: "documents" #corresponds to the defined group in the scoring app. https://github.com/panosc-eu/panosc-search-scoring/blob/master/docs/md/PaNOSC_Federated_Search_Results_Scoring_API.md#model + limit: 1000 flask_reloader: false log_level: "DEBUG" log_location: "/home/runner/work/datagateway/datagateway/datagateway-api/datagateway_api/logs.log" diff --git a/datagateway_api/src/common/config.py b/datagateway_api/src/common/config.py index 5babca19..9f190bb7 100644 --- a/datagateway_api/src/common/config.py +++ b/datagateway_api/src/common/config.py @@ -121,6 +121,14 @@ class Config: validate_assignment = True +class SearchScoring(BaseModel): + enabled: StrictBool + api_url: StrictStr + api_request_timeout: StrictInt + group: StrictStr + limit: StrictInt + + class SearchAPI(BaseModel): """ Configuration model class that implements pydantic's BaseModel class to allow for @@ -133,10 +141,7 @@ class SearchAPI(BaseModel): mechanism: StrictStr username: StrictStr password: StrictStr - scoring_enabled: StrictBool - scoring_server: StrictStr - scoring_group: StrictStr - scoring_limit: StrictInt + search_scoring: SearchScoring _validate_extension = validator("extension", allow_reuse=True)(validate_extension)