Rapporto Tecnico, Anno 7, n° 42 maggio 2012 // } // At this point let's invoke a hook for third-party modules to mess about // with the query parameters if they need to. Third party modules may alter // this object's query parameters if they wish. // module_invoke_all("islandora_solr_search_query_processor", &$this); return; } /** * Reset Results */ function resetResults() { unset($this->solrResult); } /** * Execute the query * @return type */ function executeQuery() { // //////////////////////////////////////////////////////////////////////////// // // Right here the function should be split. One function to execute the query, // // another to set up pager variables and generate display. // // //////////////////////////////////////////////////////////////////////////// // $url = variable_get('islandora_solr_search_block_url', 'http://localhost:8080/solr'); $pathParts = parse_url($url); $solr = new Apache_Solr_Service($pathParts['host'], $pathParts['port'], $pathParts['path'] . '/'); $solr->setCreateDocuments(0); $this->solrParams['hl'] = 'true'; $this->solrParams['hl.fl'] = '*'; $this->solrParams['hl.requireFieldMatch'] = 'true'; $this->solrParams['hl.snippets'] = '10'; $this->solrParams['hl.simple.pre'] = ''; $this->solrParams['hl.simple.post'] = ''; // This is where the query gets executed and output starts being created. try { $results = $solr->search($this->solrQuery, $this->solrStart, $this->solrLimit, $this->solrParams); } catch (Exception $e) { drupal_set_message(t('error searching ') . $e->getMessage()); } $this->solrResult = $results; if (empty($results)) { drupal_set_message(t('Error searching solr index. Is the solr search block configured properly?'), 'error'); return; } unset($results); unset($solr); return; } /** * Function delete_filter * * Deletes one filter from a multi-filter string * * @param $facets * @param $facet */ function delete_filter($filters, $filter) { $filters = str_replace($filter, "", $filters); $filters = str_replace("~~", "~", $filters); $filters = trim($filters, "~"); return $filters; } } 8.2.5 sites/all/modules/islandora_solr_custom/theme/islandora-solr-custom.tpl.php