Skip to content

Commit

Permalink
Fix deserialize - leave null maps null, not empty
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll committed Aug 22, 2024
1 parent 257e9e8 commit 7920125
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions server/src/main/java/org/opensearch/search/SearchHit.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ public SearchHit(
this.explanation = explanation;
this.sortValues = sortValues;
this.nestedIdentity = nestedIdentity;
this.documentFields = documentFields == null ? Collections.emptyMap() : documentFields;
this.metaFields = metaFields == null ? Collections.emptyMap() : metaFields;
this.highlightFields = highlightFields == null ? Collections.emptyMap() : highlightFields;
this.matchedQueries = matchedQueries == null ? Collections.emptyMap() : matchedQueries;
this.innerHits = innerHits == null ? Collections.emptyMap() : innerHits;
this.documentFields = documentFields;
this.metaFields = metaFields;
this.highlightFields = highlightFields;
this.matchedQueries = matchedQueries;
this.innerHits = innerHits;

// we call the setter here because that also sets the local index parameter
shard(shardTarget);
Expand All @@ -211,12 +211,12 @@ public SearchHit(SearchHit hit) throws IOException {
this.explanation = hit.explanation;
this.sortValues = hit.sortValues;
this.nestedIdentity = hit.nestedIdentity;
this.documentFields = hit.documentFields == null ? Collections.emptyMap() : hit.documentFields;
this.metaFields = hit.metaFields == null ? Collections.emptyMap() : hit.metaFields;
this.highlightFields = hit.highlightFields == null ? Collections.emptyMap() : hit.highlightFields;
this.matchedQueries = hit.matchedQueries == null ? Collections.emptyMap() : hit.matchedQueries;
this.innerHits = hit.innerHits == null ? Collections.emptyMap() : hit.innerHits;
this.sourceAsMap = hit.sourceAsMap == null ? Collections.emptyMap() : hit.sourceAsMap;
this.documentFields = hit.documentFields;
this.metaFields = hit.metaFields;
this.highlightFields = hit.highlightFields;
this.matchedQueries = hit.matchedQueries;
this.innerHits = hit.innerHits;
this.sourceAsMap = hit.sourceAsMap;

// we call the setter here because that also sets the local index parameter
shard(hit.shard);
Expand Down

0 comments on commit 7920125

Please sign in to comment.