mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-29 17:49:14 +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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.openmetadata.schema.type.EntityReference;
|
||||
import org.openmetadata.schema.type.TagLabel;
|
||||
|
||||
@ -32,20 +34,20 @@ public final class SearchIndexUtils {
|
||||
String[] pathElements = path.split("\\.");
|
||||
Map<String, Object> currentMap = jsonMap;
|
||||
|
||||
for (int i = 0; i < pathElements.length - 1; i++) {
|
||||
String key = pathElements[i];
|
||||
Object value = currentMap.get(key);
|
||||
if (value instanceof Map) {
|
||||
currentMap = (Map<String, Object>) value;
|
||||
} else if (value instanceof List) {
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) value;
|
||||
for (Map<String, Object> item : list) {
|
||||
removeFieldByPath(item, pathElements[i + 1]);
|
||||
}
|
||||
} else {
|
||||
// Path Not Found
|
||||
return;
|
||||
String key = pathElements[0];
|
||||
Object value = currentMap.get(key);
|
||||
if (value instanceof Map) {
|
||||
currentMap = (Map<String, Object>) value;
|
||||
} else if (value instanceof List) {
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) value;
|
||||
for (Map<String, Object> item : list) {
|
||||
removeFieldByPath(
|
||||
item,
|
||||
Arrays.stream(pathElements, 1, pathElements.length).collect(Collectors.joining(".")));
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the field at the last path element
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user