mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
BUG: Ensure excerpts are returned as HTMLText instances.
a7629c8bb260fd6d23c04dee7520222ca0c070c5 inadvertently made it so they were returned as plain strings due to the replace operation.
This commit is contained in:
parent
915219b6c4
commit
3dfbfdb8ef
@ -439,10 +439,17 @@ abstract class SolrIndex extends SearchIndex {
|
|||||||
foreach($res->highlighting->$docId as $field => $highlights) {
|
foreach($res->highlighting->$docId as $field => $highlights) {
|
||||||
$combinedHighlights = array_merge($combinedHighlights, $highlights);
|
$combinedHighlights = array_merge($combinedHighlights, $highlights);
|
||||||
}
|
}
|
||||||
$result->Excerpt = DBField::create_field('HTMLText', implode(' ... ', $combinedHighlights));
|
|
||||||
// Remove entity-encoded U+FFFD REPLACEMENT CHARACTER.
|
// Remove entity-encoded U+FFFD replacement character. It signifies non-displayable characters,
|
||||||
// It signifies non-displayable characters, and shows up as such itself in browsers (questionmark icon)
|
// and shows up as an encoding error in browsers.
|
||||||
$result->Excerpt = str_replace('�', '', $result->Excerpt);
|
$result->Excerpt = DBField::create_field(
|
||||||
|
'HTMLText',
|
||||||
|
str_replace(
|
||||||
|
'�',
|
||||||
|
'',
|
||||||
|
implode(' ... ', $combinedHighlights)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user