+def _get_place_info(cursor: Cursor, osm_id: Optional[str],
+ place_id: Optional[int]) -> DictCursorResult:
+ sql = """SELECT place_id, extra.*
+ FROM placex, LATERAL placex_indexing_prepare(placex) as extra
+ """
+
+ values: Tuple[Any, ...]
+ if osm_id:
+ osm_type = osm_id[0].upper()
+ if osm_type not in 'NWR' or not osm_id[1:].isdigit():
+ LOG.fatal('OSM ID must be of form <N|W|R><id>. Got: %s', osm_id)
+ raise UsageError("OSM ID parameter badly formatted")
+
+ sql += ' WHERE placex.osm_type = %s AND placex.osm_id = %s'
+ values = (osm_type, int(osm_id[1:]))
+ elif place_id is not None:
+ sql += ' WHERE placex.place_id = %s'
+ values = (place_id, )
+ else:
+ LOG.fatal("No OSM object given to index.")
+ raise UsageError("OSM object not found")
+
+ cursor.execute(sql + ' LIMIT 1', values)
+
+ if cursor.rowcount < 1:
+ LOG.fatal("OSM object %s not found in database.", osm_id)
+ raise UsageError("OSM object not found")
+
+ return cast(DictCursorResult, cursor.fetchone())
+
+
+def analyse_indexing(config: Configuration, osm_id: Optional[str] = None,
+ place_id: Optional[int] = None) -> None: