protected function SearchApiSolrService::sanitizeAndFormatExcerptSnippet in Search API Solr 7
Parameters
$snippet:
Return value
string|string[]
1 call to SearchApiSolrService::sanitizeAndFormatExcerptSnippet()
- SearchApiSolrService::extractHighlightingSnippets in includes/
service.inc - Extracts short snippets with highlighting from highlighted field values.
File
- includes/
service.inc, line 2769
Class
- SearchApiSolrService
- Search service class using Solr server.
Code
protected function sanitizeAndFormatExcerptSnippet($snippet) {
// Sanitize and format the snippet.
$snippet = check_plain($snippet);
$snippet = $this
->formatHighlighting($snippet);
// The created fragments sometimes have leading or trailing punctuation.
// We remove that here for all common cases, but take care not to remove
// < or > (so HTML tags stay valid).
$snippet = trim($snippet, "\0../:;=?..@[..`");
return $snippet;
}