Skip to content

Instantly share code, notes, and snippets.

@randallknutson
Last active December 14, 2015 07:19
Show Gist options
  • Save randallknutson/5049544 to your computer and use it in GitHub Desktop.
Save randallknutson/5049544 to your computer and use it in GitHub Desktop.
Solr Settings
/**
* Implements hook_default_search_api_server().
*/
function yourmodule_default_search_api_server() {
$items = array();
$host = variable_get('solr_search_api_host', 'localhost');
$port = variable_get('solr_search_api_port', '8983');
$path = variable_get('solr_search_api_path', '\\/solr');
$items['solr'] = entity_import('search_api_server', '{
"name" : "Solr server",
"machine_name" : "solr",
"description" : "",
"class" : "search_api_solr_service",
"options" : {
"host" : "' . $host . '",
"port" : "' . $port . '",
"path" : "' . $path . '",
"http_user" : "",
"http_pass" : "",
"excerpt" : 1,
"retrieve_data" : 1,
"highlight_data" : 1
},
"enabled" : "1",
"rdf_mapping" : []
}');
return $items;
}
Then add the following in settings.php:
$conf['solr_search_api_host'] = 'https://my.search.server';
$conf['solr_search_api_port'] = '8080';
$conf['solr_search_api_path'] = '\\/solr';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment