You are here

interface DrupalApacheSolrServiceInterface in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.interface.inc \DrupalApacheSolrServiceInterface
  2. 6.3 apachesolr.interface.inc \DrupalApacheSolrServiceInterface

The interface for all 'Service' objects.

Hierarchy

Expanded class hierarchy of DrupalApacheSolrServiceInterface

All classes that implement DrupalApacheSolrServiceInterface

2 string references to 'DrupalApacheSolrServiceInterface'
apachesolr_get_solr in ./apachesolr.module
Factory method for solr singleton objects. Structure allows for an arbitrary number of solr objects to be used based on a name whie maps to the host, port, path combination. Get an instance like this: try { $solr = apachesolr_get_solr(); } catch…
apachesolr_server_status in ./apachesolr.module
Checks if a specific Apache Solr server is available.

File

./apachesolr.interface.inc, line 343

View source
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);

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

  /**
   * 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);

  /**
   * 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');

  /**
   * Get the current solr version. This could be 1, 3 or 4
   *
   * @return int
   *   1, 3 or 4. Does not give a more details version, for that you need
   *   to get the system info.
   */
  function getSolrVersion();

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalApacheSolrServiceInterface::addDocuments function Add an array of Solr Documents to the index all at once 2
DrupalApacheSolrServiceInterface::clearCache function Clear cached Solr data. 2
DrupalApacheSolrServiceInterface::commit function Send a commit command. Will be synchronous unless both wait parameters are set to false. 2
DrupalApacheSolrServiceInterface::deleteById function Create a delete document based on document ID 2
DrupalApacheSolrServiceInterface::deleteByMultipleIds function Create and post a delete document based on multiple document IDs. 2
DrupalApacheSolrServiceInterface::deleteByQuery function Create a delete document based on a query and submit it 2
DrupalApacheSolrServiceInterface::getFields function Get just the field meta-data about the index. 2
DrupalApacheSolrServiceInterface::getId function 2
DrupalApacheSolrServiceInterface::getLuke function Get meta-data about the index. 2
DrupalApacheSolrServiceInterface::getSolrVersion function Get the current solr version. This could be 1, 3 or 4 2
DrupalApacheSolrServiceInterface::getStats function Get information about the Solr Core. 2
DrupalApacheSolrServiceInterface::getStatsSummary function Get summary information about the Solr Core. 2
DrupalApacheSolrServiceInterface::getSystemInfo function Get information about the Solr Core. 2
DrupalApacheSolrServiceInterface::getUrl function Get the Solr url 2
DrupalApacheSolrServiceInterface::makeServletRequest function Make a request to a servlet (a path) that's not a standard path. 2
DrupalApacheSolrServiceInterface::optimize function Send an optimize command. Will be synchronous unless both wait parameters are set to false. 2
DrupalApacheSolrServiceInterface::ping function Call the /admin/ping servlet, to test the connection to the server. 2
DrupalApacheSolrServiceInterface::search function Simple Search interface 2
DrupalApacheSolrServiceInterface::setUrl function Set the Solr url. 2
DrupalApacheSolrServiceInterface::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. 2
DrupalApacheSolrServiceInterface::__construct function Constructor 2