You are here

function search_api_solr_site_hash in Search API Solr 7

Returns a unique hash for the current site.

This is used to identify Solr documents from different sites within a single Solr server.

Return value

string A unique site hash, containing only alphanumeric characters.

6 calls to search_api_solr_site_hash()
SearchApiSolrService::createId in includes/service.inc
Creates an ID used as the unique identifier at the Solr server.
SearchApiSolrService::deleteItems in includes/service.inc
Implements SearchApiServiceInterface::deleteItems().
SearchApiSolrService::getAutocompleteSuggestions in includes/service.inc
SearchApiSolrService::indexItems in includes/service.inc
Indexes the specified items.
SearchApiSolrService::search in includes/service.inc
Executes a search on the server represented by this object.

... See full list

1 string reference to 'search_api_solr_site_hash'
search_api_solr_uninstall in ./search_api_solr.install
Implements hook_uninstall().

File

./search_api_solr.module, line 247
Provides a Solr-based service class for the Search API.

Code

function search_api_solr_site_hash() {

  // Copied from apachesolr_site_hash().
  if (!($hash = variable_get('search_api_solr_site_hash', FALSE))) {
    global $base_url;
    $hash = substr(base_convert(sha1(uniqid($base_url, TRUE)), 16, 36), 0, 6);
    variable_set('search_api_solr_site_hash', $hash);
  }
  return $hash;
}