You are here

function apachesolr_views_handler_field_snippet::render in Apache Solr Views 6

File

handlers/apachesolr_views_handler_field_snippet.inc, line 64
provides a field handler for the snippet coming from the ApacheSolr search engine

Class

apachesolr_views_handler_field_snippet
@file provides a field handler for the snippet coming from the ApacheSolr search engine

Code

function render($doc) {
  $response = apachesolr_static_response_cache();
  $hl_fl = $this->query
    ->get_param('hl.fl');
  if (is_null($hl_fl)) {
    $hl_fl = 'body';
  }
  $snippet = isset($response->highlighting->{$doc->id}->{$hl_fl}) ? theme('apachesolr_search_snippets', $doc, $response->highlighting->{$doc->id}->{$hl_fl}) : $doc->body;
  return $snippet;
}