Fix Search Index for ER Model (#19349)

This commit is contained in:
Mohit Yadav 2025-01-14 19:47:48 +05:30 committed by GitHub
parent a8b30370a3
commit 3c2f037534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
package org.openmetadata.service.search.indexes; package org.openmetadata.service.search.indexes;
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
import static org.openmetadata.schema.type.Include.NON_DELETED; import static org.openmetadata.schema.type.Include.ALL;
import static org.openmetadata.service.Entity.FIELD_DESCRIPTION; import static org.openmetadata.service.Entity.FIELD_DESCRIPTION;
import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME; import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME;
import static org.openmetadata.service.Entity.getEntityByName; import static org.openmetadata.service.Entity.getEntityByName;
@ -196,7 +196,7 @@ public interface SearchIndex {
String destinationIndexName = null; String destinationIndexName = null;
try { try {
if (updateForeignTableIndex) { if (updateForeignTableIndex) {
relatedEntity = getEntityByName(Entity.TABLE, relatedEntityFQN, "*", NON_DELETED); relatedEntity = getEntityByName(Entity.TABLE, relatedEntityFQN, "*", ALL);
IndexMapping destinationIndexMapping = IndexMapping destinationIndexMapping =
Entity.getSearchRepository() Entity.getSearchRepository()
.getIndexMapping(relatedEntity.getEntityReference().getType()); .getIndexMapping(relatedEntity.getEntityReference().getType());
@ -253,8 +253,7 @@ public interface SearchIndex {
.findFrom(entity.getId(), Entity.TABLE, Relationship.RELATED_TO.ordinal()); .findFrom(entity.getId(), Entity.TABLE, Relationship.RELATED_TO.ordinal());
for (CollectionDAO.EntityRelationshipRecord table : relatedTables) { for (CollectionDAO.EntityRelationshipRecord table : relatedTables) {
Table foreignTable = Table foreignTable = Entity.getEntity(Entity.TABLE, table.getId(), "tableConstraints", ALL);
Entity.getEntity(Entity.TABLE, table.getId(), "tableConstraints", NON_DELETED);
processConstraints(foreignTable, entity, constraints, false); processConstraints(foreignTable, entity, constraints, false);
} }
return constraints; return constraints;