From 8724ab29509d625a9934c0bdb39f96239e422beb Mon Sep 17 00:00:00 2001 From: Hitesh Khandelwal Date: Wed, 12 Jun 2024 12:26:27 +0530 Subject: [PATCH 1/2] fix names --- .../apache/atlas/model/discovery/AtlasSearchResult.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/intg/src/main/java/org/apache/atlas/model/discovery/AtlasSearchResult.java b/intg/src/main/java/org/apache/atlas/model/discovery/AtlasSearchResult.java index 015e32a0b9..96bc0dc587 100644 --- a/intg/src/main/java/org/apache/atlas/model/discovery/AtlasSearchResult.java +++ b/intg/src/main/java/org/apache/atlas/model/discovery/AtlasSearchResult.java @@ -174,12 +174,12 @@ public void addSort(String guid, ArrayList sort) { if(MapUtils.isEmpty(this.searchMetadata)) { this.searchMetadata = new LinkedHashMap<>(); } - ElasticsearchMetadata v = this.searchMetadata.getOrDefault(guid, new ElasticsearchMetadata()); - v.addSort(sort); + ElasticsearchMetadata sortMetadata = this.searchMetadata.getOrDefault(guid, new ElasticsearchMetadata()); + sortMetadata.addSort(sort); if (this.searchMetadata.containsKey(guid)) { - this.searchMetadata.replace(guid, v); + this.searchMetadata.replace(guid, sortMetadata); } else { - this.searchMetadata.put(guid, v); + this.searchMetadata.put(guid, sortMetadata); } } From 3b2a6f14fd1d7fea64c29ee562a559f76cc9f4da Mon Sep 17 00:00:00 2001 From: Hitesh Khandelwal Date: Wed, 12 Jun 2024 16:03:19 +0530 Subject: [PATCH 2/2] remove unnecessary if condition --- .../atlas/model/discovery/ElasticsearchMetadata.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/intg/src/main/java/org/apache/atlas/model/discovery/ElasticsearchMetadata.java b/intg/src/main/java/org/apache/atlas/model/discovery/ElasticsearchMetadata.java index 66bd40f038..8f6c9e9b3b 100644 --- a/intg/src/main/java/org/apache/atlas/model/discovery/ElasticsearchMetadata.java +++ b/intg/src/main/java/org/apache/atlas/model/discovery/ElasticsearchMetadata.java @@ -31,13 +31,7 @@ public void addHighlights(Map> highlights) { public Object getSort() { return sort; } public void addSort(ArrayList sort) { - - if(!sort.isEmpty()) { - if (MapUtils.isEmpty(this.highlights)) { - this.sort = new ArrayList<>(); - } - this.sort = sort; - } + this.sort = sort; } @Override