in geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContext.java [123:152]
private Set<String> setWhereClauses() {
Set<String> clauses = new HashSet<>();
for (String countryCode : this.getCountryHits()) {
String gazType = countryCode.equalsIgnoreCase("us") ? " AND gazsource:usgs" : " AND gazsource:geonames";
if (countryCode.toLowerCase().matches(REGEX)) {
gazType = " AND gazsource:region";
}
Map<String, String> provsForCountry = this.getProvRefMap().get(countryCode);
if (provsForCountry == null) {
provsForCountry = new HashMap<>();
}
Map<String, String> provs = new HashMap<>();
// if (!provsForCountry.isEmpty()) {
// for (String pcode : provsForCountry.keySet()) {
// if (this.getProvHits().contains(pcode)) {
// provs.put(pcode, provsForCountry.get(pcode));
//
// clauses.add(" countrycode:" + countryCode + " AND admincode:" + pcode + gazType);
//
// }
// }
// }
if (provs.isEmpty()) {
//got a country with no mentioned provs
clauses.add(" countrycode:" + countryCode + gazType);
}
}
return clauses;
}