-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KBMBF-452: #37 Show ratio of oer-content
Refactoring
- Loading branch information
Robert Meissner
committed
Jul 18, 2022
1 parent
6a6272c
commit e75f275
Showing
9 changed files
with
55 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,12 @@ | ||
from typing import Union | ||
|
||
from elasticsearch_dsl import connections | ||
|
||
from app.core.config import ELASTICSEARCH_TIMEOUT, ELASTICSEARCH_URL | ||
from app.core.logging import logger | ||
|
||
from .fields import ElasticField, ElasticFieldType | ||
|
||
|
||
async def connect_to_elastic(): | ||
logger.debug(f"Attempt to open connection: {ELASTICSEARCH_URL}") | ||
|
||
connections.create_connection( | ||
hosts=[ELASTICSEARCH_URL], timeout=ELASTICSEARCH_TIMEOUT | ||
) | ||
|
||
|
||
def handle_text_field(qfield: Union[ElasticField, str]) -> str: | ||
if isinstance(qfield, ElasticField): | ||
qfield_key = qfield.path | ||
if qfield.field_type is ElasticFieldType.TEXT: | ||
qfield_key = f"{qfield_key}.keyword" | ||
return qfield_key | ||
else: | ||
return qfield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters