--- dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java 2015/02/15 16:53:13 2303 +++ dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java 2015/02/15 17:09:02 2305 @@ -34,6 +34,7 @@ int postnr=0; boolean google = false; boolean osm = false; + String helperSearchKey = ""; try { postnr = Integer.parseInt(postnrStr); @@ -57,31 +58,37 @@ Long gadeident = postnrVeje.get(vasketVejnavn); + if ( gadeident == null) { - gadeident = helperCache.get(vasketVejnavn); + helperSearchKey = "" + postnr + "/" + vasketVejnavn; + gadeident = helperCache.get(helperSearchKey); } if ( gadeident == null) { String googleVej = GeocodeHelper.googleHelper(postnr, split.vej ); + google = true; + if (googleVej != null) { String googleVasket = AddressUtils.vaskVejnavn( googleVej ); gadeident = postnrVeje.get(googleVasket); - google = true; + if (gadeident != null) { - helperCache.put(googleVasket, gadeident); + helperCache.put(helperSearchKey, gadeident); } } } if ( gadeident == null) { String osmVej = GeocodeHelper.openstreetmapHelper(postnr, split.vej ); + osm = true; + if (osmVej != null) { String osmVasket = AddressUtils.vaskVejnavn( osmVej ); gadeident = postnrVeje.get(osmVasket); - osm = true; + if (gadeident != null) { - helperCache.put(osmVasket, gadeident); + helperCache.put(helperSearchKey, gadeident); } } }