fixed city name detection: finds now also substrings of city names

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6300 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 18aa0609ca
commit 342c5d0fd4

@ -38,9 +38,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.zip.GZIPInputStream;
@ -170,8 +170,11 @@ public class OpenGeoDB {
*/
public HashSet<Coordinates> find(String anyname) {
HashSet<Integer> r = new HashSet<Integer>();
List<Integer> c;
c = this.locationName2ids.get(anyname); if (c != null) r.addAll(c);
SortedMap<String, List<Integer>> cities = this.locationName2ids.tailMap(anyname);
for (Map.Entry<String, List<Integer>> e: cities.entrySet()) {
if (e.getKey().toLowerCase().startsWith(anyname.toLowerCase())) r.addAll(e.getValue()); else break;
}
List<Integer> c;
c = this.kfz2ids.get(anyname); if (c != null) r.addAll(c);
c = this.predial2ids.get(anyname); if (c != null) r.addAll(c);
Integer i = this.zip2id.get(anyname); if (i != null) r.add(i);

Loading…
Cancel
Save