I'm using Search API and Search API ElasticSearch. I encounter a strange issue under the following circumstances:
1. Have existing working index
2. Remove server from the index, disabling and clearing the index
3. Add the server back to the index and reindex some content
4. Date fields supplied by ElasticSearch are not rendered properly in views showing the index
UNTIL
Clear caches, and the indexed dates get rendered properly in the views.
search_api_views will run views_invalidate_cache() whenever an index is updated and its fields are changed.
Adding a check for newly enabled indexes will fix this issue.
I think the fix belongs to search_api rather than search_api_elasticsearch since the issue could happen elsewhere down the line.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2928769-3--index_enabled_clear_views_cache.patch | 1.18 KB | drunken monkey |
Comments
Comment #2
jannis commentedHere is a patch that checks if an index was newly enabled during the hook_search_api_index_update implementation.
Comment #3
drunken monkeyThanks for reporting this issue and already providing a fix!
You're right, it seems we overlooked that when writing that hook implementation. The attached revision just cleans up coding standards and makes it, I think, a bit clearer. But generally the patch looked great already.
Please test if the new version still works for you and I'll commit it.
Comment #4
jannis commentedJust applied your patch to a fresh search_api and it applied cleanly, and properly cleared the views cache on newly enabled search indexes.
RTBC +1
Comment #5
jannis commentedComment #7
drunken monkeyGood to hear, thanks a lot for testing!
Committed.
Thanks again!