diff --git a/Drupal_Apache_Solr_Service.php b/Drupal_Apache_Solr_Service.php
index 092846e..feb9585 100644
--- a/Drupal_Apache_Solr_Service.php
+++ b/Drupal_Apache_Solr_Service.php
@@ -62,7 +62,7 @@
  * methods for pinging, adding, deleting, committing, optimizing and searching.
  */
 
-class DrupalApacheSolrService {
+class DrupalApacheSolrService implements DrupalApacheSolrServiceInterface {
   /**
    * How NamedLists should be formatted in the output.  This specifically effects facet counts. Valid values
    * are 'map' (default) or 'flat'.
@@ -425,7 +425,7 @@ class DrupalApacheSolrService {
    *
    * This is just a wrapper around drupal_http_request().
    */
-  protected function _makeHttpRequest($url, $options = array()) {
+  protected function _makeHttpRequest($url, array $options = array()) {
     if (!isset($options['method']) || $options['method'] == 'GET' || $options['method'] == 'HEAD') {
       // Make sure we are not sending a request body.
       $options['data'] = NULL;
@@ -766,10 +766,7 @@ class DrupalApacheSolrService {
    *
    * @throws Exception If an error occurs during the service call
    */
-  public function search($query = '', $params = array(), $method = 'GET') {
-    if (!is_array($params)) {
-      $params = array();
-    }
+  public function search($query = '', array $params = array(), $method = 'GET') {
     // Always use JSON. See http://code.google.com/p/solr-php-client/issues/detail?id=6#c1 for reasoning
     $params['wt'] = 'json';
     // Additional default params.
diff --git a/apachesolr.interface.inc b/apachesolr.interface.inc
index fb45c31..e6b987a 100644
--- a/apachesolr.interface.inc
+++ b/apachesolr.interface.inc
@@ -311,3 +311,242 @@ interface DrupalSolrQueryInterface {
   function solr($method);
 }
 
+/**
+ * The interface for all 'Service' objects.
+ */
+interface DrupalApacheSolrServiceInterface {
+  /**
+   * Call the /admin/ping servlet, to test the connection to the server.
+   *
+   * @param $timeout
+   *   maximum time to wait for ping in seconds, -1 for unlimited (default 2).
+   * @return
+   *   (float) seconds taken to ping the server, FALSE if timeout occurs.
+   */
+  function ping($timeout = 2);
+
+  /**
+   * Call the /admin/system servlet
+   *
+   * @return
+   *   (array) With all the system info
+   */
+  function setSystemInfo();
+
+  /**
+   * Get information about the Solr Core.
+   *
+   * @return
+   *   (string) system info encoded in json
+   */
+  function getSystemInfo();
+
+  /**
+   * Get just the field meta-data about the index.
+   */
+  function getFields($num_terms = 0);
+
+  /**
+   * Get meta-data about the index.
+   */
+  function getLuke($num_terms = 0);
+
+  /**
+   * Get information about the Solr Core.
+   *
+   * Returns a Simple XMl document
+   */
+  function getStats();
+
+  /**
+   * Get summary information about the Solr Core.
+   */
+  function getStatsSummary();
+
+  /**
+   * Clear cached Solr data.
+   */
+  function clearCache();
+
+  /**
+   * Constructor
+   *
+   * @param $url
+   *   The URL to the Solr server, possibly including a core name.  E.g. http://localhost:8983/solr/
+   *   or https://search.example.com/solr/core99/
+   * @param $env_id
+   *   The machine name of a corresponding saved configuration used for loading
+   *   data like which facets are enabled.
+   */
+  function __construct($url, $env_id = NULL);
+
+  function getId();
+
+  /**
+   * Make a request to a servlet (a path) that's not a standard path.
+   *
+   * @param string $servlet
+   *   A path to be added to the base Solr path. e.g. 'extract/tika'
+   *
+   * @param array $params
+   *   Any request parameters when constructing the URL.
+   *
+   * @param array $options
+   *  @see drupal_http_request() $options.
+   *
+   * @return
+   *  response object
+   *
+   * @thows Exception
+   */
+  function makeServletRequest($servlet, $params = array(), $options = array());
+
+  /**
+   * Escape a value for special query characters such as ':', '(', ')', '*', '?', etc.
+   *
+   * NOTE: inside a phrase fewer characters need escaped, use {@link DrupalApacheSolrService::escapePhrase()} instead
+   *
+   * @param string $value
+   * @return string
+   */
+  static function escape($value);
+
+  /**
+   * Escape a value meant to be contained in a phrase for special query characters
+   *
+   * @param string $value
+   * @return string
+   */
+  static function escapePhrase($value);
+
+  /**
+   * Convenience function for creating phrase syntax from a value
+   *
+   * @param string $value
+   * @return string
+   */
+  static function phrase($value);
+
+  /**
+   * Get the Solr url
+   *
+   * @return string
+   */
+  function getUrl();
+
+  /**
+   * Set the Solr url.
+   *
+   * @param $url
+   *
+   * @return $this
+   */
+  function setUrl($url);
+
+  /**
+   * Raw update Method. Takes a raw post body and sends it to the update service. Post body
+   * should be a complete and well formed xml document.
+   *
+   * @param string $rawPost
+   * @param float $timeout Maximum expected duration (in seconds)
+   *
+   * @return response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function update($rawPost, $timeout = FALSE);
+
+  /**
+   * Add an array of Solr Documents to the index all at once
+   *
+   * @param array $documents Should be an array of ApacheSolrDocument instances
+   * @param boolean $allowDups
+   * @param boolean $overwritePending
+   * @param boolean $overwriteCommitted
+   *
+   * @return response objecte
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function addDocuments($documents, $overwrite = NULL, $commitWithin = NULL);
+
+  /**
+   * Send a commit command.  Will be synchronous unless both wait parameters are set to false.
+   *
+   * @param boolean $optimize Defaults to true
+   * @param boolean $waitFlush Defaults to true
+   * @param boolean $waitSearcher Defaults to true
+   * @param float $timeout Maximum expected duration (in seconds) of the commit operation on the server (otherwise, will throw a communication exception). Defaults to 1 hour
+   *
+   * @return response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function commit($optimize = true, $waitFlush = true, $waitSearcher = true, $timeout = 3600);
+
+  /**
+   * Create a delete document based on document ID
+   *
+   * @param string $id Expected to be utf-8 encoded
+   * @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
+   *
+   * @return response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function deleteById($id, $timeout = 3600);
+
+  /**
+   * Create and post a delete document based on multiple document IDs.
+   *
+   * @param array $ids Expected to be utf-8 encoded strings
+   * @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
+   *
+   * @return response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function deleteByMultipleIds($ids, $timeout = 3600);
+
+  /**
+   * Create a delete document based on a query and submit it
+   *
+   * @param string $rawQuery Expected to be utf-8 encoded
+   * @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
+   * @return stdClass response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function deleteByQuery($rawQuery, $timeout = 3600);
+
+  /**
+   * Send an optimize command.  Will be synchronous unless both wait parameters are set
+   * to false.
+   *
+   * @param boolean $waitFlush
+   * @param boolean $waitSearcher
+   * @param float $timeout Maximum expected duration of the commit operation on the server (otherwise, will throw a communication exception)
+   *
+   * @return response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600);
+
+  /**
+   * Like PHP's built in http_build_query(), but uses rawurlencode() and no [] for repeated params.
+   */
+  function httpBuildQuery(array $query, $parent = '');
+
+  /**
+   * Simple Search interface
+   *
+   * @param string $query The raw query string
+   * @param array $params key / value pairs for other query parameters (see Solr documentation), use arrays for parameter keys used more than once (e.g. facet.field)
+   *
+   * @return response object
+   *
+   * @throws Exception If an error occurs during the service call
+   */
+  function search($query = '', array $params = array(), $method = 'GET');
+}
diff --git a/apachesolr.module b/apachesolr.module
index b28e1de..324f10c 100644
--- a/apachesolr.module
+++ b/apachesolr.module
@@ -1503,7 +1503,7 @@ function apachesolr_static_response_cache($searcher, $response = NULL) {
  *
  * @throws Exception
  */
-function apachesolr_drupal_query($name, $params = array(), $solrsort = '', $base_path = '', $solr = NULL) {
+function apachesolr_drupal_query($name, array $params = array(), $solrsort = '', $base_path = '', $solr = NULL) {
   if (!interface_exists('DrupalSolrQueryInterface')) {
     require_once(dirname(__FILE__) . '/apachesolr.interface.inc');
   }
diff --git a/apachesolr_access/tests/apachesolr_access.test b/apachesolr_access/tests/apachesolr_access.test
index 222a778..e429ed5 100644
--- a/apachesolr_access/tests/apachesolr_access.test
+++ b/apachesolr_access/tests/apachesolr_access.test
@@ -117,7 +117,7 @@ class DrupalApacheSolrNodeAccess extends DrupalWebTestCase {
 
     $this->assertEqual($expected_criterion, $found_criterion, 'All Criteria was accounted for in fields. If not accounted for, Unaccounted Criteria [' . var_export(array_diff($expected_criterion, $found_criterion), 1) . ']');
     // Run a query through the MLT code to be sure access filters are added.
-    $solr = new DummySolr();
+    $solr = new DummySolr($url = NULL, $env_id);
     $settings = apachesolr_search_mlt_block_defaults();
     // Dummy value
     $id = apachesolr_document_id($author_restricted_node->nid);
diff --git a/apachesolr_search.module b/apachesolr_search.module
index ca5e15c..292cf8b 100644
--- a/apachesolr_search.module
+++ b/apachesolr_search.module
@@ -994,13 +994,14 @@ function apachesolr_search_run_empty($name, array $params = array(), $base_path
  *   other than the base path of the current request.
  * @param integer $page
  *   For pagination.
- * @param $caller
+ * @param DrupalApacheSolrServiceInterface $solr
+ *   The solr server resource to execute the search on.
  *
  * @return stdClass $response
  *
  * @throws Exception
  */
-function apachesolr_search_run($name, array $params = array(), $solrsort = '', $base_path = '', $page = 0, $solr = NULL) {
+function apachesolr_search_run($name, array $params = array(), $solrsort = '', $base_path = '', $page = 0, DrupalApacheSolrServiceInterface $solr = NULL) {
   // Merge the default params into the params sent in.
   $params += apachesolr_search_basic_params();
   // This is the object that knows about the query coming from the user.
diff --git a/tests/Dummy_Solr.php b/tests/Dummy_Solr.php
index 5288007..7e5a39c 100644
--- a/tests/Dummy_Solr.php
+++ b/tests/Dummy_Solr.php
@@ -5,12 +5,13 @@
  *   Dummy object to simulate a Solr Service
  *
  */
-class DummySolr {
+class DummySolr extends DrupalApacheSolrService implements DrupalApacheSolrServiceInterface {
+
   function getId() {
     return __CLASS__;
   }
 
-  function getFields() {
+  function getFields($num_terms = 0) {
     return (object) array(
        'is_uid' =>
       (object) array(
@@ -226,7 +227,7 @@ class DummySolr {
 
   protected $last_search = array();
 
-  public function search($query = '', $params = array(), $method = 'GET') {
+  public function search($query = '', array $params = array(), $method = 'GET') {
     $this->last_search = array('query' => $query, 'params' => $params, 'method' => $method);
     $response = new stdClass();
     $response->response = new stdClass();
diff --git a/tests/apachesolr_base.test b/tests/apachesolr_base.test
index b38e551..7189663 100644
--- a/tests/apachesolr_base.test
+++ b/tests/apachesolr_base.test
@@ -331,7 +331,7 @@ class DrupalSolrOfflineSearchPagesWebTestCase extends DrupalWebTestCase {
     $this->drupalGet('admin/config/search/apachesolr/search-pages');
     $this->assertNoText(t('Test Search Page'), t('Search Environment was succesfully deleted'));
     apachesolr_environment_save(array('env_id' => 'DummySolr', 'service_class' => 'DummySolr', 'name' => 'dummy server', 'url' => 'http://localhost:8983/solr'));
-    $solr = new DummySolr();
+    $solr = new DummySolr($url = NULL, $env_id = 'DummySolr');
     $params = array(
       'rows' => 5,
     );
