Skip to content

Commit

Permalink
Bugfix a indexación de metadatos
Browse files Browse the repository at this point in the history
En casos de múltiples catálogos (nodos) cargados, solo el primero tenía
sus metadatos indexados de manera correcta.
  • Loading branch information
lucaslavandeira committed Dec 11, 2018
1 parent e3b9a63 commit a65e554
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run(self):
IndexMetadataTask.info(self.task,
u'Inicio de la indexación de metadatos de {}'
.format(node.catalog_id))
index_created = index_created or CatalogMetadataIndexer(node, self.task, index).index()
index_created = CatalogMetadataIndexer(node, self.task, index).index() or index_created
IndexMetadataTask.info(self.task, u'Fin de la indexación de metadatos de {}'
.format(node.catalog_id))
except Exception as e:
Expand Down
21 changes: 21 additions & 0 deletions series_tiempo_ar_api/apps/metadata/tests/indexer_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ def test_index_unavailable_fields(self):

self.assertFalse(index_ok)

def test_multiple_catalogs(self):
self._index(catalog_id='test_catalog',
catalog_url='single_distribution.json')

self._index(catalog_id='other_catalog',
catalog_url='second_single_distribution.json')

search = Search(
index=fake_index._name,
using=self.elastic
).filter('term',
catalog_id='test_catalog')
self.assertTrue(search.execute())

other_search = Search(
index=fake_index._name,
using=self.elastic
).filter('term',
catalog_id='other_catalog')
self.assertTrue(other_search.execute())

def _index(self, catalog_id, catalog_url, set_availables=True):
node = Node.objects.create(
catalog_id=catalog_id,
Expand Down

0 comments on commit a65e554

Please sign in to comment.