diff --git a/apachesolr_views_query.inc b/apachesolr_views_query.inc index a182202..77c8405 100644 --- a/apachesolr_views_query.inc +++ b/apachesolr_views_query.inc @@ -127,7 +127,7 @@ class apachesolr_views_query extends views_plugin_query { } $solr = apachesolr_get_solr($env_id); - $query = new ApachesolrViewsSolrBaseQuery('apachesolr', $solr, $this->query_params, '', current_path()); + $query = new ApachesolrViewsSolrBaseQuery('apachesolr', $solr, $this->query_params, '', current_path(), '', $view); // Add sorting. The setSolrsort method can't be used, because it doesn't support multiple sorting criteria. $query->replaceParam('sort', $this->orderby); diff --git a/apachesolr_views_solr_base_query.inc b/apachesolr_views_solr_base_query.inc index 712131b..25a4c40 100644 --- a/apachesolr_views_solr_base_query.inc +++ b/apachesolr_views_solr_base_query.inc @@ -7,6 +7,41 @@ class ApachesolrViewsSolrBaseQuery extends SolrBaseQuery { + // The view related with this query object. + protected $view; + + /** + * Constructs a new archiver instance. + * + * @param string $name + * The search name, used for finding the correct blocks and other config. + * Typically "apachesolr". + * + * @param string $solr + * An instantiated DrupalApacheSolrService Object. + * Can be instantiated from apachesolr_get_solr(). + * + * @param array $params + * Array of params to initialize the object (typically 'q' and 'fq'). + * + * @param string $sortstring + * Visible string telling solr how to sort - added to GET query params. + * + * @param string $base_path + * The search base path (without the keywords) for this query, + * without trailing slash. + * + * @param array $context + * The context related with this query. + * + * @param object $view + * The view object related with this query. + */ + public function __construct($name, $solr, array $params = array(), $sortstring = '', $base_path = '', $context = array(), $view = new stdClass()) { + parent::__construct($name, $solr, $params, $sortstring, $base_path, $context); + $this->view = $view; + } + /** * Need to set proper base path for facets. */ @@ -16,4 +51,11 @@ class ApachesolrViewsSolrBaseQuery extends SolrBaseQuery { } return $this->base_path; } + + /** + * Returns the view related with this query object. + */ + public function getView() { + return $this->view; + } }