From 604ad0844c8c86b358ff7d13ef95548fd25508c9 Mon Sep 17 00:00:00 2001 From: Lucas Lavandeira <19612265+lucaslavandeira@users.noreply.github.com> Date: Tue, 27 Mar 2018 10:21:05 -0300 Subject: [PATCH] =?UTF-8?q?Mejora=20a=20la=20performance=20de=20indexaci?= =?UTF-8?q?=C3=B3n=20de=20metadatos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apps/metadata/indexer/metadata_indexer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/series_tiempo_ar_api/apps/metadata/indexer/metadata_indexer.py b/series_tiempo_ar_api/apps/metadata/indexer/metadata_indexer.py index 06a05a84..26c8b044 100644 --- a/series_tiempo_ar_api/apps/metadata/indexer/metadata_indexer.py +++ b/series_tiempo_ar_api/apps/metadata/indexer/metadata_indexer.py @@ -41,7 +41,7 @@ def scrap_datajson(self): actions = [] for field in self.data_json.get_fields(only_time_series=True): dataset = datasets.setdefault(field['dataset_identifier'], - self.data_json.get_dataset(identifier=field['dataset_identifier'])) + self.get_dataset(identifier=field['dataset_identifier'])) doc = Field( title=field.get('title'), @@ -58,6 +58,11 @@ def scrap_datajson(self): actions.append(doc.to_dict(include_meta=True)) return actions + def get_dataset(self, identifier): + for dataset in self.data_json['dataset']: + if dataset['identifier'] == identifier: + return dataset + @staticmethod def get_themes(theme_taxonomy): themes = {}