Change indexed post type name/label

// For facets with post types as source, the name that is shown in the facet's choices is the labels->name set when registering the post type.
// See: https://developer.wordpress.org/reference/functions/register_post_type/
// If you need it to be something else, e.g. labels->singular_name, the following code will index that name.
// Replace 'my_facet_name' with the name of your facet.
// Post type labels array overview: https://developer.wordpress.org/reference/functions/get_post_type_labels/

add_filter( 'facetwp_index_row', function( $params, $class ) {
  $name = $params['facet_name'];
  if ( in_array( $name, [ 'my_facet_name' ] ) ) { // you can add multiple facets to the array
    $post_id = (int) $params['post_id'];
    $post_type_obj = get_post_type_object( get_post_type($post_id) );
    $params['facet_display_value'] = $post_type_obj->labels->singular_name;
  }
  return $params;
}, 10, 2 );