facetwp index relationship

<?php

/** make the datasource something you know will always have a value for every post - like post title - it
 ** is only a placeholder and won't be indexed 
 **/

add_filter( 'facetwp_index_row', function( $params, $class ) {
	if ( 'search_new' == $params['facet_name'] ) { // change my_facet to name of your facet
		
		$project_id = $params['post_id'];
		
		/** some code here to make an array of post ids of
		    people posts that are associated with the project **/
		
		// loop of array of people post ids you have created above
		foreach ( $people_posts as $people ) {
			// Update the values to be inserted into database.
			$people_title = get_the_title( $people );
			$people_params = $params;
			$people_params['facet_value'] = $people_title;
			$people_params['facet_display_value'] = $people_title;
			// Insert each value to the database.
			$class->insert( $people_params );
		}
		
		$params['facet_value'] = ''; // we won't index the original value
	}
	return $params;
}, 10, 2 );