For now, Search Api isn't handling indexing of exportables entity types.
I had an issue with the Countries module because of this.
Search API is always assuming that the entity identifier is an integer e.g (index_entity.inc) :

if (isset($entity_types[$type])) {
  $flat[$key]['type'] = search_api_nest_type('integer', $info['type']);
  $flat[$key]['entity_type'] = $type;
}

And _search_api_extract_entity_value called in search_api_extract_fields is using the getIdentifier method of the wrapper to return the value.
Finally the getIdentier method of the wrapper is returning the value of the id through the entity method :

  $key = isset($info['entity keys']['name']) ? $info['entity keys']['name'] : $info['entity keys']['id'];

The solution to solve this issue is to do the same test inside getFields() of the index_entity module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jsacksick’s picture

Status: Active » Needs review
FileSize
653 bytes

Here is a patch proposal

drunken monkey’s picture

Looks pretty good, thanks for spotting and fixing this!

I guess I should do a small announcement before committing this, though, as other modules might rely on this behaviour. We'll also have to update the documentation.

drunken monkey’s picture

Component: Miscellaneous » Framework
drunken monkey’s picture

Note: If you are indexing entity references with such name keys (and it didn't work previously, probably indexing 0s for all IDs), you'll have to re-save the "Fields" form and re-index your content for the patch to fix this.

drunken monkey’s picture

Status: Needs review » Fixed

Committed, thanks again!

Automatically closed -- issue fixed for 2 weeks with no activity.