Skip to content

Commit 3c1fe0d

Browse files
committed
added indexes to mongo
1 parent bb8fe8d commit 3c1fe0d

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

ted_sws/data_manager/adapters/mapping_suite_repository.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import shutil
55
from typing import Iterator, List, Optional
66

7-
from pymongo import MongoClient
7+
from pymongo import MongoClient, ASCENDING
88

99
from ted_sws import config
1010
from ted_sws.core.model.transform import MappingSuite, FileResource, TransformationRuleSet, SHACLTestSuite, \
@@ -39,6 +39,7 @@ 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)])
4243

4344
def add(self, mapping_suite: MappingSuite):
4445
"""

ted_sws/data_manager/adapters/notice_repository.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Iterator, Union, Optional
44

55
import gridfs
6-
from pymongo import MongoClient
6+
from pymongo import MongoClient, ASCENDING
77
from bson import ObjectId
88
from ted_sws import config
99
from ted_sws.core.model.manifestation import XMLManifestation, RDFManifestation, METSManifestation, Manifestation
@@ -28,6 +28,7 @@ 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)])
3132

3233
def get_file_content_from_grid_fs(self, file_id: str) -> str:
3334
"""

0 commit comments

Comments
 (0)