You are here

public static function Utility::formatHighlighting in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::formatHighlighting()
  2. 8.2 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::formatHighlighting()
  3. 4.x src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::formatHighlighting()

Changes highlighting tags from our custom, HTML-safe ones to HTML.

Parameters

string|array $snippet: The snippet(s) to format.

Return value

string|array The snippet(s), properly formatted as HTML.

1 call to Utility::formatHighlighting()
SearchApiSolrBackend::getExcerpt in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Extract and format highlighting information for a specific item.

File

src/Utility/Utility.php, line 190

Class

Utility
Utility functions specific to solr.

Namespace

Drupal\search_api_solr\Utility

Code

public static function formatHighlighting($snippet) {
  return preg_replace('#\\[(/?)HIGHLIGHT\\]#', '<$1strong>', $snippet);
}