You are here

function hook_apachesolr_delete_by_query_alter in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.api.php \hook_apachesolr_delete_by_query_alter()
  2. 7 apachesolr.api.php \hook_apachesolr_delete_by_query_alter()

Allows a module to modify the delete query.

Parameters

string $query: This is not an instance of DrupalSolrQueryInterface, it is the raw query that is being sent to Solr. Defaults to "*:*".

2 invocations of hook_apachesolr_delete_by_query_alter()
apachesolr_index_delete_bundles in ./apachesolr.index.inc
Delete from the index documents with the entity type and any of the excluded bundles.
apachesolr_index_delete_index in ./apachesolr.index.inc
Delete the whole index for an environment.

File

./apachesolr.api.php, line 212
Exposed Hooks in 7.x:

Code

function hook_apachesolr_delete_by_query_alter(&$query) {

  // Use the site hash so that you only delete this site's content.
  if ($query == '*:*') {
    $query = 'hash:' . apachesolr_site_hash();
  }
  else {
    $query .= ' AND hash:' . apachesolr_site_hash();
  }
}