You are here

public function SearchApiIndex::clear in Search API 7

Clears this search index and schedules all of its items for re-indexing.

Return value

bool TRUE on success, FALSE on failure.

File

includes/index_entity.inc, line 335
Contains SearchApiIndex.

Class

SearchApiIndex
Class representing a search index.

Code

public function clear() {
  if (!$this->server || $this->read_only) {
    return TRUE;
  }
  try {
    $this
      ->server()
      ->deleteItems('all', $this);
  } catch (SearchApiException $e) {
    watchdog_exception('search_api', $e);
  }
  _search_api_index_reindex($this);
  module_invoke_all('search_api_index_reindex', $this, TRUE);
  return TRUE;
}