You are here

function apachesolr_get_solr in Apache Solr Search 5

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_get_solr()
  2. 5.2 apachesolr.module \apachesolr_get_solr()
  3. 6.3 apachesolr.module \apachesolr_get_solr()
  4. 6 apachesolr.module \apachesolr_get_solr()
  5. 6.2 apachesolr.module \apachesolr_get_solr()
  6. 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();

7 calls to apachesolr_get_solr()
ApacheSolrUpdate::update_index in ./apachesolr.module
apachesolr_delete_index_form_submit in ./apachesolr.module
apachesolr_mlt_suggestions in contrib/apachesolr_mlt/apachesolr_mlt.module
function apachesolr_mlt_suggestions() This function loads a the parameters for each moreLikeThis query, performs the query, and returns a list of linked node titles.
apachesolr_multisitesearch_search in contrib/apachesolr_multisitesearch/apachesolr_multisitesearch.module
Implementation of hook_search().
apachesolr_nodeapi in ./apachesolr.module
Implementation of hook_nodeapi().

... See full list

File

./apachesolr.module, line 704
Integration with the Apache Solr search application.

Code

function &apachesolr_get_solr($host = 'localhost', $port = 8983, $path = '/solr') {
  static $solr_cache;
  if (empty($solr_cache[$host][$port][$path])) {
    $include_path = get_include_path();
    set_include_path('./' . drupal_get_path('module', 'apachesolr') . '/SolrPhpClient/');
    include_once 'Apache/Solr/Service.php';
    set_include_path($include_path);
    $solr_cache[$host][$port][$path] = new Apache_Solr_Service($host, $port, $path);
  }
  return $solr_cache[$host][$port][$path];
}