facetwp fselect only parent terms

<?php add_filter( 'facetwp_index_row', function( $params, $class ) {
	if ( 'my_facet' == $params['facet_name'] ) { // change my_facet
		if ( !empty( $params['parent_id'] ) ) {
			$params['facet_value'] = ''; // skip indexing
		}
	}
	return $params;
}, 10, 2 );