public function SearchApiDbService::preDelete in Search API Database Search 7
Implements SearchApiServiceInterface::__construct().
By default, deletes all indexes from this server.
Overrides SearchApiAbstractService::preDelete
File
- ./
service.inc, line 254 - Contains SearchApiDbService.
Class
- SearchApiDbService
- Indexes and searches items using the database.
Code
public function preDelete() {
// Only react on real deletes, not on reverts.
if ($this->server
->hasStatus(ENTITY_IN_CODE)) {
return;
}
if (empty($this->options['indexes'])) {
return;
}
foreach ($this->options['indexes'] as $index) {
foreach ($index as $field) {
// Some fields share a de-normalized table, brute force since
// everything is going.
if ($this->connection
->schema()
->tableExists($field['table'])) {
$this->connection
->schema()
->dropTable($field['table']);
}
}
}
}