- LOG.warning("Update postcodes centroid")
- conn = connect(args.config.get_libpq_dsn())
- refresh.update_postcodes(conn, args.sqllib_dir)
- conn.close()
+ if postcodes.can_compute(args.config.get_libpq_dsn()):
+ LOG.warning("Update postcodes centroid")
+ tokenizer = self._get_tokenizer(args.config)
+ postcodes.update_postcodes(args.config.get_libpq_dsn(),
+ args.project_dir, tokenizer)
+ indexer = Indexer(args.config.get_libpq_dsn(), tokenizer,
+ args.threads or 1)
+ indexer.index_postcodes()
+ else:
+ LOG.error("The place table doesn't exist. "
+ "Postcode updates on a frozen database is not possible.")
+
+ if args.word_tokens:
+ tokenizer = self._get_tokenizer(args.config)
+ tokenizer.update_word_tokens()