Skip to content

Commit

Permalink
always use latest country info file (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
aspedrosa authored Mar 15, 2022
1 parent 99d2793 commit e184976
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
1 change: 0 additions & 1 deletion geowebservice/country.csv

This file was deleted.

4 changes: 2 additions & 2 deletions geowebservice/geodatabase/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def load_country_info(self, countryFile):
with open(countryFile, "rU") as ifile:
reader = csv.reader(ifile, delimiter="\t")

self.countryInfo = {row[11]: {'continent': row[8], 'name': row[4]} for row in reader}
self.countryInfo = {row[16]: {'continent': row[8], 'name': row[4]} for row in reader}

def load_initial_data(self, allCountriesFile):
logger.info("Load initial data to Solr")
Expand Down Expand Up @@ -78,7 +78,7 @@ def load_initial_data(self, allCountriesFile):
list_docs_to_commit.append(d)
if i % 60000 == 0:
self.solr.add(list_docs_to_commit)
list_docs_to_commit = []
list_docs_to_commit.clear()
print(i)

self.solr.add(list_docs_to_commit)
Expand Down
16 changes: 12 additions & 4 deletions geowebservice/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,24 @@ done
(
set -e

docker-compose exec -T solr sh -c "solr create_core -c geonames -d _default"
docker-compose exec -T solr sh -c """
solr create_core -c geonames -d _default
solr config -c geonames -p 8983 -action set-user-property -property update.autoCreateFields -value false
"""

docker-compose up -d geodropdownservice

docker-compose exec -T geodropdownservice sh -c """
set -x
wget -P /tmp http://download.geonames.org/export/dump/allCountries.zip
wget -nv -P /tmp http://download.geonames.org/export/dump/allCountries.zip
unzip /tmp/allCountries.zip -d /tmp
python manage.py load_data country.csv /tmp/allCountries.txt
rm /tmp/allCountries.*
wget -nv -P /tmp http://download.geonames.org/export/dump/countryInfo.txt
sed -i "/^#/d" /tmp/countryInfo.txt

python manage.py load_data /tmp/countryInfo.txt /tmp/allCountries.txt
rm -f /tmp/allCountries.* /tmp/countryInfo.txt
"""
)
Expand Down

0 comments on commit e184976

Please sign in to comment.