Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
filter out empty value for entity features (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
ylwu-amzn authored Nov 4, 2020
1 parent 2b78d10 commit 75d564b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,11 @@ public void getFeaturesByEntities(
.stream()
.filter(agg -> AGG_NAME_TERM.equals(agg.getName()))
.flatMap(agg -> ((Terms) agg).getBuckets().stream())
.collect(
Collectors.toMap(Terms.Bucket::getKeyAsString, bucket -> parseBucket(bucket, detector.getEnabledFeatureIds()).get())
);
.collect(Collectors.toMap(Terms.Bucket::getKeyAsString, bucket -> parseBucket(bucket, detector.getEnabledFeatureIds())))
.entrySet()
.stream()
.filter(entry -> entry.getValue().isPresent())
.collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().get()));

listener.onResponse(results);
}, listener::onFailure);
Expand Down

0 comments on commit 75d564b

Please sign in to comment.