Facetwp apply SearchWP highlight

<?php
/**
 * Modify the output HTML and highlighting all search terms in a Listing Builder template
 */
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;
    }

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