File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
indexer/src/main/scala/importers/geonames Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 2
2
2147714|Syd
3
3
1273294|New Delhi
4
4
5106834|Albania
5
+ 5117472|Flushing
Original file line number Diff line number Diff line change @@ -571,11 +571,13 @@ class GeonamesParser(
571
571
val lines = scala.io.Source .fromFile(new File (filename)).getLines
572
572
573
573
lines.foreach(line => {
574
- val parts = line.split(" \t " ).toList
574
+ val parts = line.split(" [\t ]" ).toList
575
+
575
576
for {
576
577
gid <- parts.lift(0 )
577
- lang <- parts.lift(1 ).flatMap(_.split(" \\ |" ).lift(0 ))
578
- name <- parts.lift(1 ).flatMap(_.split(" \\ |" ).lift(1 ))
578
+ val rest = parts.drop(1 ).mkString(" " )
579
+ lang <- rest.split(" \\ |" ).lift(0 )
580
+ name <- rest.split(" \\ |" ).lift(1 )
579
581
} {
580
582
val records = store.getById(GeonamesId (gid.toLong)).toList
581
583
records match {
@@ -586,9 +588,11 @@ class GeonamesParser(
586
588
if (dn.lang == lang) {
587
589
if (dn.name == name) {
588
590
foundName = true
589
- DisplayName (dn.lang, dn.name, dn.flags | FeatureNameFlags .PREFERRED .getValue())
591
+ val newName = DisplayName (dn.lang, dn.name, dn.flags | FeatureNameFlags .PREFERRED .getValue())
592
+ newName
590
593
} else {
591
- DisplayName (dn.lang, dn.name, dn.flags ^ FeatureNameFlags .PREFERRED .getValue())
594
+ val newName = DisplayName (dn.lang, dn.name, dn.flags ^ FeatureNameFlags .PREFERRED .getValue())
595
+ newName
592
596
}
593
597
} else {
594
598
dn
You can’t perform that action at this time.
0 commit comments