facetwp searchwp highlight

<?php
/**
 * Modify the output HTML and highlighting all search terms
 */
add_filter( 'facetwp_render_output', function( $output, $params ) {
    $keywords = '';

    if ( isset( FWP()->facet->facets['search'] ) ) {
        $keywords = FWP()->facet->facets['search']['selected_values'];
        $keywords = is_array( $keywords ) ? implode( ' ', $keywords ) : $keywords;
    }

    if ( ! empty( $keywords ) && class_exists( 'SearchWPHighlighter' ) ) {
        $highlighter = new SearchWPHighlighter();
        $output['template'] = $highlighter->apply_highlight( $output['template'], $keywords );
    }
    return $output;
}, 10, 2 );