Skip to content
Permalink
Browse files

Fix SQL Server full-text search bug

  • Loading branch information...
chrisgraham committed Jul 29, 2019
1 parent a44f17f commit ecd4a05f69017c0a2e5211fa88a1fe2972c44882
Showing with 4 additions and 1 deletion.
  1. +4 −1 sources/database/shared/sqlserver.php
@@ -172,8 +172,11 @@ public function db_create_index($table_name, $index_name, $_fields, $db, $raw_ta
$unique_index_name = 'unique__' . $table_name;
$ret[] = 'IF NOT EXISTS (SELECT * FROM sys.indexes WHERE name=\'' . $unique_index_name . '\' AND object_id=OBJECT_ID(\'' . $table_name . '\')) CREATE UNIQUE INDEX ' . $unique_index_name . ' ON ' . $table_name . '(' . $unique_key_fields . ')';
// Delete full-text index if already exists
$ret[] = 'IF EXISTS (SELECT * FROM sys.fulltext_indexes WHERE object_id=OBJECT_ID(\'' . $table_name . '\')) DROP FULLTEXT INDEX ON ' . $table_name;
// Create full-text index on table if needed
$ret[] = 'IF NOT EXISTS (SELECT * FROM sys.fulltext_indexes WHERE object_id=OBJECT_ID(\'' . $table_name . '\')) CREATE FULLTEXT INDEX ON ' . $table_name . '(' . $_fields . ') KEY INDEX ' . $unique_index_name;
$ret[] = 'CREATE FULLTEXT INDEX ON ' . $table_name . '(' . $_fields . ') KEY INDEX ' . $unique_index_name;
}
return $ret;
}

0 comments on commit ecd4a05

Please sign in to comment.
You can’t perform that action at this time.