You are here

function SolrBaseQuery::__construct in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 Solr_Base_Query.php \SolrBaseQuery::__construct()
  2. 6.3 Solr_Base_Query.php \SolrBaseQuery::__construct()

Parameters

$name: The search name, used for finding the correct blocks and other config. Typically "apachesolr".

$solr: An instantiated DrupalApacheSolrService Object. Can be instantiated from apachesolr_get_solr().

$params: Array of params to initialize the object (typically 'q' and 'fq').

$sortstring: Visible string telling solr how to sort - added to GET query params.

$base_path: The search base path (without the keywords) for this query, without trailing slash.

Overrides SolrFilterSubQuery::__construct

File

./Solr_Base_Query.php, line 310
This class allows you to make operations on a query that will be sent to Apache Solr. methods such as adding and removing sorts, remove and replace parameters, adding and removing filters, getters and setters for various parameters and more

Class

SolrBaseQuery

Code

function __construct($name, $solr, array $params = array(), $sortstring = '', $base_path = '', $context = array()) {
  parent::__construct();
  $this->name = $name;
  $this->solr = $solr;
  $this
    ->addContext((array) $context);
  $this
    ->addParams((array) $params);
  $this->available_sorts = $this
    ->defaultSorts();
  $this->sortstring = trim($sortstring);
  $this
    ->parseSortString();
  $this->base_path = $base_path;
}