CREATE INDEX {{sql.if_index_not_exists}} idx_osmline_parent_osm_id
ON location_property_osmline USING BTREE (osm_id) {{db.tablespace.search_index}};
-CREATE UNIQUE INDEX {{sql.if_index_not_exists}} idx_postcode_id
- ON location_postcode USING BTREE (place_id) {{db.tablespace.search_index}};
-
CREATE INDEX {{sql.if_index_not_exists}} idx_postcode_postcode
ON location_postcode USING BTREE (postcode) {{db.tablespace.search_index}};
postcode TEXT,
geometry GEOMETRY(Geometry, 4326)
);
+CREATE UNIQUE INDEX idx_postcode_id ON location_postcode USING BTREE (place_id) {{db.tablespace.search_index}};
CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry) {{db.tablespace.address_index}};
GRANT SELECT ON location_postcode TO "{{config.DATABASE_WEBUSER}}" ;
class APILookup:
"""\
- Execute API reverse query.
+ Execute API lookup query.
"""
@staticmethod
class APIDetails:
"""\
- Execute API lookup query.
+ Execute API details query.
"""
@staticmethod
""" Print final statistics about the progress.
"""
rank_end_time = datetime.now()
- diff_seconds = (rank_end_time-self.rank_start_time).total_seconds()
+
+ if rank_end_time == self.rank_start_time:
+ diff_seconds = 0
+ places_per_sec = self.done_places
+ else:
+ diff_seconds = (rank_end_time - self.rank_start_time).total_seconds()
+ places_per_sec = self.done_places/diff_seconds
LOG.warning("Done %d/%d in %d @ %.3f per second - FINISHED %s\n",
self.done_places, self.total_places, int(diff_seconds),
- self.done_places/diff_seconds, self.name)
+ places_per_sec, self.name)
+import logging
from itertools import chain
import psycopg2.extras
from place_inserter import PlaceColumn
from table_compare import NominatimID, DBRow
-from nominatim.indexer.indexer import Indexer
+from nominatim.indexer import indexer
def check_database_integrity(context):
""" Check some generic constraints on the tables.
GROUP BY country_code, pc""")
# Call directly as the refresh function does not include postcodes.
- indexer = Indexer(context.nominatim.get_libpq_dsn(), 1)
- indexer.index_full(analyse=False)
+ indexer.LOG.setLevel(logging.ERROR)
+ indexer.Indexer(context.nominatim.get_libpq_dsn(), 1).index_full(analyse=False)
check_database_integrity(context)