Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
original-brownbear committed Jan 2, 2024
1 parent bab9bce commit d1affc4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public void run() {
}
hit.getInnerHits().put(innerHitBuilder.getName(), innerHits);
innerHits.mustIncRef();
context.addReleasable(innerHits::decRef);
}
}
onPhaseDone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ public Map<String, SearchHits> getInnerHits() {
}

public void setInnerHits(Map<String, SearchHits> innerHits) {
assert innerHits.values().stream().noneMatch(h -> h.hasReferences() == false);
assert innerHits == null || innerHits.values().stream().noneMatch(h -> h.hasReferences() == false);
assert this.innerHits == null;
this.innerHits = innerHits;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ private void hitExecute(Map<String, InnerHitsContext.InnerHitSubContext> innerHi
var h = fetchResult.hits();
results.put(entry.getKey(), h);
h.mustIncRef();
innerHitsContext.addReleasable(h::decRef);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public void testCollapseSingleHit() throws IOException {
final int numInnerHits = randomIntBetween(1, 5);
List<SearchHits> collapsedHits = new ArrayList<>(numInnerHits);
for (int innerHitNum = 0; innerHitNum < numInnerHits; innerHitNum++) {
SearchHits hits = new SearchHits(
new SearchHit[] { new SearchHit(innerHitNum, "ID"), new SearchHit(innerHitNum + 1, "ID") },
SearchHits hits = SearchHits.unpooled(
new SearchHit[] { SearchHit.unpooled(innerHitNum, "ID"), SearchHit.unpooled(innerHitNum + 1, "ID") },
new TotalHits(2, TotalHits.Relation.EQUAL_TO),
1.0F
);
Expand Down

0 comments on commit d1affc4

Please sign in to comment.