Problem/Motivation
I've noticed that when a read-only index is deleted the deleteItems() function for that service is called.
Should it be? Doesn't this contradict the fact that it's read-only?
Would this be a problem out in the wild?
The only reason I've come across this is I haven't yet implemented indexItems() or deleteItems() for the IDOL search service (data is currently populated by IDOL, not Drupal).
Instead these functions throw an exception.
Proposed resolution
Prevent deleteItems() being called when deleting read-only indexes. ??
Remaining tasks
Evaluate if this is an issue and it's impact to everyday users of Search API.
User interface changes
Mention on the "Do you really want to delete this index?" page for a read-only index that data will not be removed. ??
API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1246998-3--deleteIndex_for_read_only_indexes.patch | 1.72 KB | drunken monkey |
Comments
Comment #1
drunken monkeyYour point makes sense, I guess we really shouldn't delete items from a read-only index. Do you want to provide a patch? (Mentioning this on the deletion confirm form would also be a good idea, probably.)
Comment #2
Akaoni commentedFixing typo and also pushing this higher up in my queue so I don't forget (again). ;)
Comment #3
drunken monkeyI guess this will have to be fixed by service classes, as we can't know what they'll do in
deleteItems(). The attached patch would add documentation to that effect, fixes the default implementation (which had a bug anyways) and also refrains from calling thedeleteItems()method later for currently disabled servers if the removed index was read-only (since then the server would only get the index's ID and wouldn't be able to tell whether it was read-only).Please review and see if these changes make sense to you. And again, thanks for reporting!
See also #2020903: Fix deletion of indexed data when a read-only index is removed from the server for the database search. The Solr backend already fixed this a while ago.
Comment #4
drunken monkeyCommitted.