+class BoundaryRunner(object):
+ """ Returns SQL commands for indexing the administrative boundaries
+ by partition.
+ """
+
+ def name(self):
+ return "boundaries"
+
+ def sql_count_objects(self):
+ return """SELECT count(*) FROM placex
+ WHERE indexed_status > 0
+ AND rank_search < 26
+ AND class = 'boundary' and type = 'administrative'"""
+
+ def sql_get_objects(self):
+ return """SELECT place_id FROM placex
+ WHERE indexed_status > 0 and rank_search < 26
+ and class = 'boundary' and type = 'administrative'
+ ORDER BY partition, admin_level"""
+
+ def sql_index_place(self, ids):
+ return "UPDATE placex SET indexed_status = 0 WHERE place_id IN ({})"\
+ .format(','.join((str(i) for i in ids)))