Skip to content

Commit 086d67f

Browse files
committed
updated indexes
1 parent 3c1fe0d commit 086d67f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ted_sws/data_manager/adapters/mapping_suite_repository.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def __init__(self, mongodb_client: MongoClient, database_name: str = _database_n
3939
self._database_name = database_name
4040
notice_db = mongodb_client[self._database_name]
4141
self.collection = notice_db[self._collection_name]
42-
self.collection.create_index([("identifier", ASCENDING)])
4342

4443
def add(self, mapping_suite: MappingSuite):
4544
"""
@@ -67,7 +66,7 @@ def get(self, reference) -> MappingSuite:
6766
:param reference:
6867
:return: MappingSuite
6968
"""
70-
result_dict = self.collection.find_one({"identifier": reference})
69+
result_dict = self.collection.find_one({"_id": reference})
7170
return MappingSuite(**result_dict) if result_dict else None
7271

7372
def list(self) -> Iterator[MappingSuite]:

ted_sws/data_manager/adapters/notice_repository.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def __init__(self, mongodb_client: MongoClient, database_name: str = _database_n
2828
notice_db = mongodb_client[self._database_name]
2929
self.file_storage = gridfs.GridFS(notice_db)
3030
self.collection = notice_db[self._collection_name]
31-
self.collection.create_index([("ted_id", ASCENDING)])
31+
self.file_storage_collection = notice_db["fs.files"]
32+
self.file_storage_collection.create_index([("notice_id", ASCENDING)])
3233

3334
def get_file_content_from_grid_fs(self, file_id: str) -> str:
3435
"""
@@ -177,7 +178,7 @@ def get(self, reference) -> Optional[Notice]:
177178
:param reference:
178179
:return: Notice
179180
"""
180-
result_dict = self.collection.find_one({"ted_id": reference})
181+
result_dict = self.collection.find_one({"_id": reference})
181182
if result_dict is not None:
182183
notice = NoticeRepository._create_notice_from_repository_result(result_dict)
183184
notice = self.load_notice_fields_from_grid_fs(notice)

0 commit comments

Comments
 (0)