From 8a18b5776dc3e1eed453d262c2aca31b91ac26e8 Mon Sep 17 00:00:00 2001 From: Ferran Llamas Date: Mon, 21 Oct 2024 12:45:08 +0200 Subject: [PATCH] Deduplicate labels (#2555) --- nucliadb/src/nucliadb/ingest/orm/brain.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nucliadb/src/nucliadb/ingest/orm/brain.py b/nucliadb/src/nucliadb/ingest/orm/brain.py index fe205cccaf..4ffb4bd0e1 100644 --- a/nucliadb/src/nucliadb/ingest/orm/brain.py +++ b/nucliadb/src/nucliadb/ingest/orm/brain.py @@ -472,7 +472,8 @@ def _set_resource_labels(self, basic: Basic, origin: Optional[Origin]): _, p1, p2 = LABEL_HIDDEN.split("/") self.labels[p1].add(p2) - self.compute_labels() + self.brain.ClearField("labels") + self.brain.labels.extend(flatten_resource_labels(self.labels)) def process_field_metadata( self, @@ -584,9 +585,6 @@ def apply_field_labels( self.brain.texts[field_key].labels.extend(flatten_resource_labels(labels)) - def compute_labels(self): - self.brain.labels.extend(flatten_resource_labels(self.labels)) - def is_paragraph_repeated_in_field( paragraph: Paragraph,