Fixed getRegionName and improved osmlive filename recognition
This commit is contained in:
parent
dd72744c44
commit
67cd31df93
2 changed files with 10 additions and 5 deletions
|
@ -407,14 +407,18 @@ public class BinaryMapIndexReader {
|
||||||
}
|
}
|
||||||
String ls = rg.get(0);
|
String ls = rg.get(0);
|
||||||
if (ls.lastIndexOf('_') != -1) {
|
if (ls.lastIndexOf('_') != -1) {
|
||||||
if (ls.matches(".*([0-9]+_*){3}\\.obf")) {
|
if (ls.matches("([a-zA-Z-]+_)+([0-9]+_){2}[0-9]+\\.obf")) {
|
||||||
Pattern osmDiffDateEnding = Pattern.compile("_([0-9]+_*){3}\\.obf");
|
Pattern osmDiffDateEnding = Pattern.compile("_([0-9]+_){2}[0-9]+\\.obf");
|
||||||
Matcher m = osmDiffDateEnding.matcher(ls);
|
Matcher m = osmDiffDateEnding.matcher(ls);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
ls = ls.substring(0, m.start());
|
ls = ls.substring(0, m.start());
|
||||||
}
|
if (ls.lastIndexOf('_') != -1) {
|
||||||
return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' ');
|
return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' ');
|
||||||
|
} else {
|
||||||
|
return ls;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ls.contains(".")) {
|
if (ls.contains(".")) {
|
||||||
ls = ls.substring(0, ls.indexOf("."));
|
ls = ls.substring(0, ls.indexOf("."));
|
||||||
|
|
|
@ -587,7 +587,8 @@ public class SearchPhrase {
|
||||||
Iterator<BinaryMapIndexReader> it = indexes.iterator();
|
Iterator<BinaryMapIndexReader> it = indexes.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
BinaryMapIndexReader r = it.next();
|
BinaryMapIndexReader r = it.next();
|
||||||
if (r.getFile().getName().matches(".*([0-9]+_*){3}\\.obf")) {
|
String filename = r.getFile().getName();
|
||||||
|
if (filename.matches("([a-zA-Z-]+_)+([0-9]+_){2}[0-9]+\\.obf")) {
|
||||||
String currRegionName = r.getRegionName();
|
String currRegionName = r.getRegionName();
|
||||||
if (result.containsKey(currRegionName)) {
|
if (result.containsKey(currRegionName)) {
|
||||||
result.get(currRegionName).add(r);
|
result.get(currRegionName).add(r);
|
||||||
|
|
Loading…
Reference in a new issue