mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-19 06:28:03 +00:00
Add cleanSearchResponseObject()
This commit is contained in:
parent
f940f27988
commit
0e2c00bd00
@ -119,7 +119,7 @@ public class SearchMetadataTool implements McpTool {
|
|||||||
"SearchMetadataTool does not support limits enforcement.");
|
"SearchMetadataTool does not support limits enforcement.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Object> cleanSearchResponse(Map<String, Object> searchResponse) {
|
public static Map<String, Object> cleanSearchResponse(Map<String, Object> searchResponse) {
|
||||||
if (searchResponse == null) return Collections.emptyMap();
|
if (searchResponse == null) return Collections.emptyMap();
|
||||||
|
|
||||||
Map<String, Object> topHits = safeGetMap(searchResponse.get("hits"));
|
Map<String, Object> topHits = safeGetMap(searchResponse.get("hits"));
|
||||||
@ -142,6 +142,12 @@ public class SearchMetadataTool implements McpTool {
|
|||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public static Map<String, Object> cleanSearchResponseObject(Map<String, Object> object) {
|
||||||
|
IGNORE_SEARCH_KEYS.forEach(object::remove);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static Map<String, Object> safeGetMap(Object obj) {
|
private static Map<String, Object> safeGetMap(Object obj) {
|
||||||
return (obj instanceof Map) ? (Map<String, Object>) obj : null;
|
return (obj instanceof Map) ? (Map<String, Object>) obj : null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user