Restricting the indexing to particular user roles

From the Relevanssi settings, you can only choose whether subscribers are indexed or not. If you need finer control over what user roles are indexed by Relevanssi, you can use the following code. Place it in your theme functions.php:

add_filter('relevanssi_user_index_ok', 'rlv_do_not_index_admins', 10, 2);
function rlv_do_not_index_admins($do_index, $user) {
	$block_these_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
 
	$vars = get_object_vars($user);
	if (is_array($vars["caps"])) {
		foreach ($vars["caps"] as $role => $val) {
			if (in_array($role, $block_these_roles)) {
				$do_index = false;
				break;
			}
		}
	}
 
	return $do_index;
}

This line determines which roles are indexed and which are not:

$block_these_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');

Remove the roles you want to include in the index. If you want only authors indexed, use

$block_these_roles = array('administrator', 'editor', 'contributor', 'subscriber');