mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-30 18:17:53 +00:00
[Issue-16906] Fix Lineage Edge Being Removed in Non-Indexable Fields (#16907)
* Fix Lineage Edge Being Removed * Else Condition
This commit is contained in:
parent
b65e084324
commit
02e06c7795
@ -1,9 +1,11 @@
|
|||||||
package org.openmetadata.service.search;
|
package org.openmetadata.service.search;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.openmetadata.schema.type.EntityReference;
|
import org.openmetadata.schema.type.EntityReference;
|
||||||
import org.openmetadata.schema.type.TagLabel;
|
import org.openmetadata.schema.type.TagLabel;
|
||||||
|
|
||||||
@ -32,20 +34,20 @@ public final class SearchIndexUtils {
|
|||||||
String[] pathElements = path.split("\\.");
|
String[] pathElements = path.split("\\.");
|
||||||
Map<String, Object> currentMap = jsonMap;
|
Map<String, Object> currentMap = jsonMap;
|
||||||
|
|
||||||
for (int i = 0; i < pathElements.length - 1; i++) {
|
String key = pathElements[0];
|
||||||
String key = pathElements[i];
|
Object value = currentMap.get(key);
|
||||||
Object value = currentMap.get(key);
|
if (value instanceof Map) {
|
||||||
if (value instanceof Map) {
|
currentMap = (Map<String, Object>) value;
|
||||||
currentMap = (Map<String, Object>) value;
|
} else if (value instanceof List) {
|
||||||
} else if (value instanceof List) {
|
List<Map<String, Object>> list = (List<Map<String, Object>>) value;
|
||||||
List<Map<String, Object>> list = (List<Map<String, Object>>) value;
|
for (Map<String, Object> item : list) {
|
||||||
for (Map<String, Object> item : list) {
|
removeFieldByPath(
|
||||||
removeFieldByPath(item, pathElements[i + 1]);
|
item,
|
||||||
}
|
Arrays.stream(pathElements, 1, pathElements.length).collect(Collectors.joining(".")));
|
||||||
} else {
|
|
||||||
// Path Not Found
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the field at the last path element
|
// Remove the field at the last path element
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user