function apachesolr_get_solr in Apache Solr Search 6.2
Same name and namespace in other branches
- 8 apachesolr.module \apachesolr_get_solr()
- 5.2 apachesolr.module \apachesolr_get_solr()
- 5 apachesolr.module \apachesolr_get_solr()
- 6.3 apachesolr.module \apachesolr_get_solr()
- 6 apachesolr.module \apachesolr_get_solr()
- 7 apachesolr.module \apachesolr_get_solr()
Factory method for solr singleton object. Structure allows for an arbitrary number of solr objects to be used based on the host, port, path combination. Get an instance like this: $solr = apachesolr_get_solr();
Throws
Exception
26 calls to apachesolr_get_solr()
- apachesolr_batch_index_nodes in ./
apachesolr.admin.inc - Batch Operation Callback
- apachesolr_clear_cache in ./
apachesolr.module - A wrapper for cache_clear_all to be used as a submit handler on forms that require clearing Luke cache etc.
- apachesolr_commentsearch_delete_comment_from_index in contrib/
apachesolr_commentsearch/ apachesolr_commentsearch.module - Removes a comment from the index.
- apachesolr_config_file in ./
apachesolr.admin.inc - Page callback to show one conf file.
- apachesolr_config_files_overview in ./
apachesolr.admin.inc - Page callback to show available conf files.
File
- ./
apachesolr.module, line 1593 - Integration with the Apache Solr search application.
Code
function apachesolr_get_solr($host = NULL, $port = NULL, $path = NULL) {
static $solr_cache;
if (empty($host)) {
$host = variable_get('apachesolr_host', 'localhost');
}
if (empty($port)) {
$port = variable_get('apachesolr_port', '8983');
}
if (empty($path)) {
$path = variable_get('apachesolr_path', '/solr');
}
if (empty($solr_cache[$host][$port][$path])) {
list($module, $filepath, $class) = variable_get('apachesolr_service_class', array(
'apachesolr',
'Drupal_Apache_Solr_Service.php',
'Drupal_Apache_Solr_Service',
));
include_once drupal_get_path('module', $module) . '/' . $filepath;
$solr = new $class($host, $port, $path);
// Set a non-default behavior.
$solr
->setCollapseSingleValueArrays(FALSE);
$solr_cache[$host][$port][$path] = $solr;
}
return $solr_cache[$host][$port][$path];
}