Now this is tricky. We need to do something with indexes created by this module when it is disabled/uninstalled, otherwise we're going to experience many nice SearchApiExceptions (Unknown or invalid item type search_api_et_node. in search_api_get_datasource_controller())

Now, for the moment I ended up with solution as per attached patch - delete all indexes created by this module when it is being disabled - although I'm open to discussion and better ideas here.

Why this way?
- If we just disable indexes when module is being disabled, all the indexes are still displayed on Search API index listing page, and a user can click on any edit/delete links, which will result in SearchApiException. Not very nice.
- Also, if we try to delete such disabled index during in hook_uninstall implementation, again, SearchApiException.

Apparently, Search API doesn't check if index's datasource controller is available before trying to use it, blindly assuming that it is. And for the moment I haven't found any way to make it work in any better way (without patching Search API module at least).

Thoughts?

Comments

maciej.zgadzaj’s picture

Status: Active » Needs review
drunken monkey’s picture

Status: Needs review » Closed (won't fix)

I guess this would have to be fixed in the Search API itself.
And I somehow remember reviewing and/or committing a similar patch a few weeks back, so maybe it's already fixed.

Also, let's just use your sandbox for now.

maciej.zgadzaj’s picture

You mean #1414048: Fix exception in views.inc removes all Search API tables perhaps? On the first sight it doesn't seem to be enough, but I might have a look into this later too...