Skip to content
Permalink
Browse files

Bug fix: When checking the existence of a resolver with a higher weig…

…ht, the absence of any attribute should imply that the resolver does not exist. Until now the boolean logic had checked for the absence of all attributes of the resolver. This has been corrected to check for the absence of any attribute of the resolver.
  • Loading branch information...
davemoore- committed Jul 18, 2019
1 parent a8e006e commit 4d97d3974ad560d5a8cbb9430b11faf467c1cb91
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/main/java/io/zentity/resolution/Job.java
@@ -688,11 +688,15 @@ else if (size == 1)
List<String> parentResolverClauses = new ArrayList<>();
for (String parentResolverName : parentResolversGroup) {

// Construct a clause that checks if every attribute of the resolver does not exist.
// Construct a clause that checks if any attribute of the resolver does not exist.
List<String> attributeExistsClauses = new ArrayList<>();
for (String attributeName : this.input.model().resolvers().get(parentResolverName).attributes())
attributeExistsClauses.add("{\"exists\":{\"field\":\"" + attributeName + "\"}}");
String attributesExistsClause = "{\"bool\":{\"must_not\":[" + String.join(",", attributeExistsClauses) + "]}}";
attributeExistsClauses.add("{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"" + attributeName + "\"}}}}");
String attributesExistsClause = "";
if (attributeExistsClauses.size() > 1)
attributesExistsClause = "{\"bool\":{\"should\":[" + String.join(",", attributeExistsClauses) + "]}}";
else if (attributeExistsClauses.size() == 1)
attributesExistsClause = attributeExistsClauses.get(0);

// Construct a clause for the resolver.
List<String> parentResolverGroup = new ArrayList<>(Arrays.asList(parentResolverName));

0 comments on commit 4d97d39

Please sign in to comment.
You can’t perform that action at this time.