You are here

class DummySolr in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 tests/Dummy_Solr.php \DummySolr
  2. 7 tests/Dummy_Solr.php \DummySolr

@file Dummy object to simulate a Solr Service

Hierarchy

Expanded class hierarchy of DummySolr

4 string references to 'DummySolr'
DrupalApacheSolrNodeAccess::setUp in apachesolr_access/tests/apachesolr_access.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
DrupalSolrNodeTestCase::setUp in tests/apachesolr_base.test
Implementation of setUp().
DrupalSolrOfflineSearchPagesWebTestCase::setUp in tests/apachesolr_base.test
Implementation of setUp().
DrupalSolrOfflineSearchPagesWebTestCase::testNewAndRemoveSearchPage in tests/apachesolr_base.test
Asserts that we can edit a search environment

File

tests/Dummy_Solr.php, line 8
Dummy object to simulate a Solr Service

View source
class DummySolr implements DrupalApacheSolrServiceInterface {
  function getId() {
    return __CLASS__;
  }
  function getFields($num_terms = 0) {
    return (object) array(
      'is_uid' => (object) array(
        'type' => 'long',
        'schema' => 'I-S----OF-----',
      ),
      'content' => (object) array(
        'type' => 'text',
        'schema' => 'ITS-V---------',
      ),
      'im_3_field_tags' => (object) array(
        'type' => 'long',
        'schema' => 'I-SM---OF-----',
        'dynamicBase' => 'im_*',
      ),
      'entity_type' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'ds_last_comment_or_change' => (object) array(
        'type' => 'tdate',
        'schema' => 'ITS----OF-----',
      ),
      'nodeaccess_ari4jj_node_access_example_view' => (object) array(
        'type' => 'integer',
        'schema' => 'I--M---OF-----',
        'dynamicBase' => 'nodeaccess*',
      ),
      'entity_id' => (object) array(
        'type' => 'tlong',
        'schema' => 'ITS----OF-----',
      ),
      'ds_changed' => (object) array(
        'type' => 'tdate',
        'schema' => 'ITS----OF-----',
      ),
      'id' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'timestamp' => (object) array(
        'type' => 'date',
        'schema' => 'I-S----OF----l',
      ),
      'label' => (object) array(
        'type' => 'text',
        'schema' => 'ITS-V--O------',
      ),
      'nodeaccess_ari4jj_node_access_example_edit' => (object) array(
        'type' => 'integer',
        'schema' => 'I--M---OF-----',
        'dynamicBase' => 'nodeaccess*',
      ),
      'ds_created' => (object) array(
        'type' => 'tdate',
        'schema' => 'ITS----OF-----',
      ),
      'ss_name' => (object) array(
        'type' => 'text',
        'schema' => 'ITS-V---------',
      ),
      'path' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'taxonomy_names' => (object) array(
        'type' => 'text',
        'schema' => 'IT-MV--O------',
      ),
      'bundle' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'tid' => (object) array(
        'type' => 'long',
        'schema' => 'I-SM---OF-----',
      ),
      'is_tnid' => (object) array(
        'type' => 'long',
        'schema' => 'I-S----OF-----',
      ),
      'nodeaccess_ari4jj_node_access_example_author' => (object) array(
        'type' => 'integer',
        'schema' => 'I--M---OF-----',
        'dynamicBase' => 'nodeaccess*',
      ),
      'tm_vid_1_names' => (object) array(
        'type' => 'text',
        'schema' => 'ITSMV---------',
        'dynamicBase' => 'tm_*',
      ),
      'spell' => (object) array(
        'type' => 'textSpell',
        'schema' => 'ITSM----------',
      ),
      'site' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'is_comment_count' => (object) array(
        'type' => 'tint',
        'schema' => 'ITS----OF-----',
      ),
      'bundle_name' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'hash' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'bs_status' => (object) array(
        'type' => 'boolean',
        'schema' => 'I-S----OF----l',
      ),
      'entity_id' => (object) array(
        'type' => 'long',
        'schema' => 'I-S----OF-----',
      ),
      'url' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'nodeaccess_all' => (object) array(
        'type' => 'integer',
        'schema' => 'I--M---OF-----',
        'dynamicBase' => 'nodeaccess*',
      ),
      'sort_name' => (object) array(
        'type' => 'sortString',
        'schema' => 'IT-----O-----l',
      ),
      'tags_a' => (object) array(
        'type' => 'text',
        'schema' => 'IT-----O------',
        'dynamicBase' => 'tags_*',
      ),
      'bs_sticky' => (object) array(
        'type' => 'boolean',
        'schema' => 'I-S----OF----l',
      ),
      'bs_promote' => (object) array(
        'type' => 'boolean',
        'schema' => 'I-S----OF----l',
      ),
      'teaser' => (object) array(
        'type' => 'text',
        'schema' => '-TS-----------',
      ),
      'im_vid_1' => (object) array(
        'type' => 'long',
        'schema' => 'I-SM---OF-----',
        'dynamicBase' => 'im_*',
      ),
      'bs_translate' => (object) array(
        'type' => 'boolean',
        'schema' => 'I-S----OF----l',
      ),
      'sort_label' => (object) array(
        'type' => 'sortString',
        'schema' => 'IT-----O-----l',
      ),
      'ss_language' => (object) array(
        'type' => 'string',
        'schema' => 'I-S----OF----l',
      ),
      'sm_vid_Tags' => (object) array(
        'type' => 'string',
        'schema' => 'I-SM---OF----l',
        'dynamicBase' => 'sm_*',
      ),
    );
  }
  protected $last_search = array();
  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();
    $response->response->numFound = 0;
    $response->response->docs = array();
    return $response;
  }
  public function getLastSearch() {
    return $this->last_search;
  }

  /**
   * 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) {
  }

  /**
   * Get information about the Solr Core.
   *
   * @return
   *   (string) system info encoded in json
   */
  function getSystemInfo() {
  }

  /**
   * 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) {
  }

  /**
   * 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()) {
  }

  /**
   * 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, $softCommit = false) {
  }

  /**
   * 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, $softCommit = false) {
  }

  /**
   * Get query name.
   */
  function getName() {
  }

  /**
   * Get query searcher name (for facetapi, views, pages, etc).
   */
  function getSearcher() {
  }

  /**
   * Get context values.
   */
  function getContext() {
  }

  /**
   * Set context value.
   */
  function addContext(array $context) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DummySolr::$last_search protected property
DummySolr::addContext function Set context value.
DummySolr::addDocuments function Add an array of Solr Documents to the index all at once Overrides DrupalApacheSolrServiceInterface::addDocuments
DummySolr::clearCache function Clear cached Solr data. Overrides DrupalApacheSolrServiceInterface::clearCache
DummySolr::commit function Send a commit command. Will be synchronous unless both wait parameters are set to false. Overrides DrupalApacheSolrServiceInterface::commit
DummySolr::deleteById function Create a delete document based on document ID Overrides DrupalApacheSolrServiceInterface::deleteById
DummySolr::deleteByMultipleIds function Create and post a delete document based on multiple document IDs. Overrides DrupalApacheSolrServiceInterface::deleteByMultipleIds
DummySolr::deleteByQuery function Create a delete document based on a query and submit it Overrides DrupalApacheSolrServiceInterface::deleteByQuery
DummySolr::getContext function Get context values.
DummySolr::getFields function Get just the field meta-data about the index. Overrides DrupalApacheSolrServiceInterface::getFields
DummySolr::getId function Overrides DrupalApacheSolrServiceInterface::getId
DummySolr::getLastSearch public function
DummySolr::getLuke function Get meta-data about the index. Overrides DrupalApacheSolrServiceInterface::getLuke
DummySolr::getName function Get query name.
DummySolr::getSearcher function Get query searcher name (for facetapi, views, pages, etc).
DummySolr::getStats function Get information about the Solr Core. Overrides DrupalApacheSolrServiceInterface::getStats
DummySolr::getStatsSummary function Get summary information about the Solr Core. Overrides DrupalApacheSolrServiceInterface::getStatsSummary
DummySolr::getSystemInfo function Get information about the Solr Core. Overrides DrupalApacheSolrServiceInterface::getSystemInfo
DummySolr::getUrl function Get the Solr url Overrides DrupalApacheSolrServiceInterface::getUrl
DummySolr::makeServletRequest function Make a request to a servlet (a path) that's not a standard path. Overrides DrupalApacheSolrServiceInterface::makeServletRequest
DummySolr::optimize function Send an optimize command. Will be synchronous unless both wait parameters are set to false. Overrides DrupalApacheSolrServiceInterface::optimize
DummySolr::ping function Call the /admin/ping servlet, to test the connection to the server. Overrides DrupalApacheSolrServiceInterface::ping
DummySolr::search public function Simple Search interface Overrides DrupalApacheSolrServiceInterface::search
DummySolr::setUrl function Set the Solr url. Overrides DrupalApacheSolrServiceInterface::setUrl
DummySolr::update function 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. Overrides DrupalApacheSolrServiceInterface::update
DummySolr::__construct function Constructor Overrides DrupalApacheSolrServiceInterface::__construct