mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
BUG Remove non-displayable chars from Solr highlight results
This commit is contained in:
parent
919716a0ce
commit
a7629c8bb2
@ -312,7 +312,7 @@ abstract class SolrIndex extends SearchIndex {
|
||||
*/
|
||||
public function search(SearchQuery $query, $offset = -1, $limit = -1, $params = array()) {
|
||||
$service = $this->getService();
|
||||
|
||||
|
||||
SearchVariant::with(count($query->classes) == 1 ? $query->classes[0]['class'] : null)->call('alterQuery', $query, $this);
|
||||
|
||||
$q = array();
|
||||
@ -440,6 +440,9 @@ abstract class SolrIndex extends SearchIndex {
|
||||
$combinedHighlights = array_merge($combinedHighlights, $highlights);
|
||||
}
|
||||
$result->Excerpt = DBField::create_field('HTMLText', implode(' ... ', $combinedHighlights));
|
||||
// Remove entity-encoded U+FFFD REPLACEMENT CHARACTER.
|
||||
// It signifies non-displayable characters, and shows up as such itself in browsers (questionmark icon)
|
||||
$result->Excerpt = str_replace('�', '', $result->Excerpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -447,7 +450,7 @@ abstract class SolrIndex extends SearchIndex {
|
||||
} else {
|
||||
$numFound = 0;
|
||||
}
|
||||
|
||||
|
||||
$ret = array();
|
||||
$ret['Matches'] = new PaginatedList($results);
|
||||
$ret['Matches']->setLimitItems(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user