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?
| Comment | File | Size | Author |
|---|---|---|---|
| hook_disable_and_hook_uninstall_implementations.patch | 1.92 KB | maciej.zgadzaj |
Comments
Comment #1
maciej.zgadzaj commentedComment #2
drunken monkeyI 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.
Comment #3
maciej.zgadzaj commentedYou 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...