Skip to content

Commit

Permalink
add scoring related values to config #398
Browse files Browse the repository at this point in the history
BREAKING CHANGE: add scoring related values to config
  • Loading branch information
VKTB committed Feb 10, 2023
1 parent dd58a8b commit b3fffc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
10 changes: 6 additions & 4 deletions datagateway_api/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 9 additions & 4 deletions datagateway_api/src/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit b3fffc2

Please sign in to comment.