Skip to content

Commit

Permalink
Fixed bug in the extraction of blocking keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpapadis committed Mar 8, 2018
1 parent 65f16da commit b602d84
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -108,19 +109,24 @@ public double getTotalNoOfEntities() {
protected void indexEntities(Map<String, TIntList> index, List<EntityProfile> entities) {
int counter = 0;
for (EntityProfile profile : entities) {
final Set<String> allKeys = new HashSet<>();
for (Attribute attribute : profile.getAttributes()) {
for (String key : getBlockingKeys(attribute.getValue())) {
String normalizedKey = key.trim().toLowerCase();
if (0 < normalizedKey.length()) {
TIntList entityList = index.get(normalizedKey);
if (entityList == null) {
entityList = new TIntArrayList();
index.put(normalizedKey, entityList);
}
entityList.add(counter);
allKeys.add(normalizedKey);
}
}
}

for (String key : allKeys) {
TIntList entityList = index.get(key);
if (entityList == null) {
entityList = new TIntArrayList();
index.put(key, entityList);
}
entityList.add(counter);
}
counter++;
}
}
Expand Down

0 comments on commit b602d84

Please sign in to comment.