From ef1d044a8f4faa62a646aa0d94a80915c551ee78 Mon Sep 17 00:00:00 2001 From: alexsilaghi Date: Mon, 9 Dec 2024 13:46:15 +0200 Subject: [PATCH] added idx --- .../model/EntityLinearizationHistory.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/EntityLinearizationHistory.java b/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/EntityLinearizationHistory.java index 5a39aa3..fee25ca 100644 --- a/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/EntityLinearizationHistory.java +++ b/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/EntityLinearizationHistory.java @@ -1,16 +1,24 @@ package edu.stanford.protege.webprotege.linearizationservice.model; import com.fasterxml.jackson.annotation.*; +import org.springframework.data.mongodb.core.index.CompoundIndex; +import org.springframework.data.mongodb.core.index.CompoundIndexes; +import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.mapping.*; import java.util.*; import static com.google.common.base.MoreObjects.toStringHelper; import static edu.stanford.protege.webprotege.linearizationservice.model.EntityLinearizationHistory.LINEARIZATION_HISTORY_COLLECTION; +import static edu.stanford.protege.webprotege.linearizationservice.model.EntityLinearizationHistory.WHOFIC_ENTITY_IRI; +import static edu.stanford.protege.webprotege.linearizationservice.model.EntityLinearizationHistory.PROJECT_ID; @JsonIgnoreProperties(ignoreUnknown = true) @Document(collection = LINEARIZATION_HISTORY_COLLECTION) +@CompoundIndexes({ + @CompoundIndex(name = "entity_iri_project_idx", def = "{'" + WHOFIC_ENTITY_IRI + "': 1, '" + PROJECT_ID + "': 1}") +}) public class EntityLinearizationHistory { public static final String WHOFIC_ENTITY_IRI = "whoficEntityIri"; @@ -19,9 +27,11 @@ public class EntityLinearizationHistory { public static final String LINEARIZATION_HISTORY_COLLECTION = "EntityLinearizationHistory"; @Field("whoficEntityIri") + @Indexed(name = "whoficEntityIri_idx") private final String whoficEntityIri; @Field("projectId") + @Indexed(name = "entityProjectId_idx") private final String projectId; @Field("linearizationRevisions")