You are here

function apachesolr_search_highlighting_params in Apache Solr Search 8

Same name and namespace in other branches
  1. 5.2 apachesolr_search.module \apachesolr_search_highlighting_params()
  2. 6.3 apachesolr_search.module \apachesolr_search_highlighting_params()
  3. 6 apachesolr_search.module \apachesolr_search_highlighting_params()
  4. 6.2 apachesolr_search.module \apachesolr_search_highlighting_params()
  5. 7 apachesolr_search.module \apachesolr_search_highlighting_params()

Add highlighting settings to the search params.

These settings are set in solrconfig.xml. See the defaults there. If you wish to override them, you can via settings.php or drush

1 call to apachesolr_search_highlighting_params()
apachesolr_search_run in ./apachesolr_search.module
Execute a search results based on keyword, filter, and sort strings.

File

./apachesolr_search.module, line 1145
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_highlighting_params(DrupalSolrQueryInterface $query = NULL) {
  $params['hl'] = variable_get('apachesolr_hl_active', NULL);
  $params['hl.fragsize'] = variable_get('apachesolr_hl_textsnippetlength', NULL);
  $params['hl.simple.pre'] = variable_get('apachesolr_hl_pretag', NULL);
  $params['hl.simple.post'] = variable_get('apachesolr_hl_posttag', NULL);
  $params['hl.snippets'] = variable_get('apachesolr_hl_numsnippets', NULL);

  // This should be an array of possible field names.
  $params['hl.fl'] = variable_get('apachesolr_hl_fieldtohighlight', NULL);
  $params = array_filter($params);
  if ($query) {
    $query
      ->addParams($params);
  }
  return $params;
}