Search API and Domain Access: Filter user per domain I've got a site with multiple domains using Domain Access.
I want to display a search form on each site that searches for users on that site. 

I'm using a modified version of the code here (that code works fine when searching for nodes) but it doesn't work.
When searching it always return an empty result.

Here's my code:

/**
* Implements hook_entity_property_info_alter().
*
* Adds an entity property for the domain access of the user.
*/
function custom_search_users_entity_property_info_alter(&amp;$info) {
  $properties = &amp;$info['user']['properties'];

  $properties['custom_search_users_domain_access'] = array(
    'label' =&gt; t('Domain Access Information'),
    'description' =&gt; t('The domains to which the user has access.'),
    'type' =&gt; 'list&lt;integer&gt;',
    'getter callback' =&gt; 'custom_search_users_get_domain_info',
  );
}

function custom_search_users_get_domain_info($data, array $options, $name, $type, $info) {
  return (!empty($data-&gt;domain_user) ? $data-&gt;domain_user : NULL);
}

/**
* Implements hook_search_api_query_alter().
*
* Adds a filter for the current domain.
*/
function custom_search_users_search_api_query_alter(SearchApiQueryInterface $query) {
  $domain = domain_get_domain();

  $query-&gt;condition('custom_search_users_domain_access', $domain['domain_id']);
}


So basically what I've changed in my code is the use of $data->domain_user instead of $data->domain to comply with the user object. 

Anyone got any idea of why this doesn't work?
I think your approach is just fine, but you forgot to index your field. You've to check the field you created on the field page (admin/config/search/search_api/index/**your_index**/fields)



Once checked, you'll be able to index your extra field and by so, filter on domain.