mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
Merge pull request #1667 from mtmail/setup-delete-invalid-indices
setup: delete invalid indices in create-search-indices step
This commit is contained in:
@@ -566,6 +566,15 @@ class SetupFunctions
|
|||||||
{
|
{
|
||||||
info('Create Search indices');
|
info('Create Search indices');
|
||||||
|
|
||||||
|
$sSQL = 'SELECT relname FROM pg_class, pg_index ';
|
||||||
|
$sSQL .= 'WHERE pg_index.indisvalid = false AND pg_index.indexrelid = pg_class.oid';
|
||||||
|
$aInvalidIndices = $this->oDB->getCol($sSQL);
|
||||||
|
|
||||||
|
foreach ($aInvalidIndices as $sIndexName) {
|
||||||
|
info("Cleaning up invalid index $sIndexName");
|
||||||
|
$this->oDB->exec("DROP INDEX $sIndexName;");
|
||||||
|
}
|
||||||
|
|
||||||
$sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql');
|
$sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql');
|
||||||
if (!$this->dbReverseOnly()) {
|
if (!$this->dbReverseOnly()) {
|
||||||
$sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql');
|
$sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql');
|
||||||
|
|||||||
Reference in New Issue
Block a user