You are here

protected function SearchApiSolrService::getHighlightParams in Search API Solr 7

Helper method for creating the highlighting parameters.

(The $query parameter currently isn't used and only here for the potential sake of subclasses.)

Parameters

SearchApiQueryInterface|SearchApiMultiQueryInterface $query: The query object, either for a normal Search API query or a multi-index query.

Return value

array An array of parameters to be added to the Solr search request.

2 calls to SearchApiSolrService::getHighlightParams()
SearchApiSolrService::search in includes/service.inc
Executes a search on the server represented by this object.
SearchApiSolrService::searchMultiple in includes/service.inc
Implements SearchApiMultiServiceInterface::searchMultiple().

File

includes/service.inc, line 2035

Class

SearchApiSolrService
Search service class using Solr server.

Code

protected function getHighlightParams($query) {
  $highlight_params = array();
  if (!empty($this->options['excerpt']) || !empty($this->options['highlight_data'])) {
    $highlight_params['hl'] = 'true';
    $highlight_params['hl.fl'] = variable_get('search_api_solr_highlight_prefix', 'tm_') . '*';
    $highlight_params['hl.simple.pre'] = '[HIGHLIGHT]';
    $highlight_params['hl.simple.post'] = '[/HIGHLIGHT]';
    $highlight_params['hl.snippets'] = 1;
    $highlight_params['hl.fragsize'] = 0;
  }
  return $highlight_params;
}