public function SearchApiIndex::save in Search API 7
Saves this index to the database.
Either creates a new record or updates the existing one with the same ID.
Return value
int|false Failure to save the index will return FALSE. Otherwise, SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed. $this->id will be set if a new index was inserted.
Overrides Entity::save
1 call to SearchApiIndex::save()
- SearchApiIndex::update in includes/
index_entity.inc - Helper method for updating entity properties.
File
- includes/
index_entity.inc, line 253 - Contains SearchApiIndex.
Class
- SearchApiIndex
- Class representing a search index.
Code
public function save() {
if (empty($this->description)) {
$this->description = NULL;
}
$server = FALSE;
if (!empty($this->server)) {
$server = search_api_server_load($this->server);
if (!$server) {
$vars['%server'] = $this->server;
$vars['%index'] = $this->name;
watchdog('search_api', 'Unknown server %server specified for index %index.', $vars, WATCHDOG_ERROR);
}
}
if (!$server) {
$this->server = NULL;
$this->enabled = FALSE;
}
if (!empty($this->options['fields'])) {
ksort($this->options['fields']);
}
$this
->resetCaches();
return parent::save();
}