From 57196e3f248346c682ac5bfc91e6b724f1f587f1 Mon Sep 17 00:00:00 2001 From: Ric Evans <19216225+ric-evans@users.noreply.github.com> Date: Thu, 4 Feb 2021 10:53:39 -0600 Subject: [PATCH] `data_type` now index; `content_status` now sparse (#66) also added some comments --- file_catalog/mongo.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/file_catalog/mongo.py b/file_catalog/mongo.py index 11bc38d..5faa83b 100644 --- a/file_catalog/mongo.py +++ b/file_catalog/mongo.py @@ -32,6 +32,7 @@ def __init__(self, host=None, port=None, authSource=None, username=None, passwor authSource=authSource, username=username, password=password).file_catalog + # all files self.client.files.create_index('uuid', unique=True, background=True) self.client.files.create_index('logical_name', unique=True, background=True) self.client.files.create_index([('logical_name',pymongo.HASHED)], background=True) @@ -39,14 +40,21 @@ def __init__(self, host=None, port=None, authSource=None, username=None, passwor self.client.files.create_index([('locations.site',pymongo.DESCENDING),('locations.path',pymongo.DESCENDING)], background=True) self.client.files.create_index('locations.archive', background=True) self.client.files.create_index('create_date', background=True) - self.client.files.create_index('content_status', background=True) + + # all .i3 files + self.client.files.create_index('content_status', sparse=True, background=True) self.client.files.create_index('processing_level', sparse=True, background=True) + self.client.files.create_index('data_type', sparse=True, background=True) + + # data_type=real files self.client.files.create_index('run_number', sparse=True, background=True) self.client.files.create_index('start_datetime', sparse=True, background=True) self.client.files.create_index('end_datetime', sparse=True, background=True) self.client.files.create_index('offline_processing_metadata.first_event', sparse=True, background=True) self.client.files.create_index('offline_processing_metadata.last_event', sparse=True, background=True) self.client.files.create_index('offline_processing_metadata.season', sparse=True, background=True) + + # data_type=simulation files self.client.files.create_index('iceprod.dataset', sparse=True, background=True) self.client.collections.create_index('uuid', unique=True, background=True)