facetwp index a PODS relationship field

<?php

/** index the post meta of a related post field in PODS
 ** $related_post_id can be used with get_post_meta or other functions to
 ** get info about the related post
 ** be sure to re-index after adding code
 **/
add_filter( 'facetwp_index_row', function( $params, $class ) {
	if ( 'my_facet' == $params['facet_name'] ) { // change my_facet to name of your facet
		$related_post_id = $params['facet_value']; // depnding on how your relationship field saves its data this might need to be changed or looked up from a different value
		$params['facet_display_value'] = get_post_meta( 'field_name', $related_post_id, true ); // lookup custom field, this would need adjusting if it returns an array rather than text string
		$params['facet_value'] = $params['facet_display_value'];
	}
	return $params;
}, 10, 2 );