Skip to content

Commit

Permalink
Deduplicate labels (#2555)
Browse files Browse the repository at this point in the history
  • Loading branch information
lferran authored Oct 21, 2024
1 parent 93e623f commit 8a18b57
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions nucliadb/src/nucliadb/ingest/orm/brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8a18b57

Please sign in to comment.