Problem/Motivation
The website encountered an unexpected error. Try again later.
Drupal\Core\Entity\EntityStorageException: Index main_en-gb does not exist in Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 763 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->request() (Line: 82)
Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->read() (Line: 36)
Algolia\AlgoliaSearch\Iterators\ObjectIterator->fetchNextPage() (Line: 63)
Algolia\AlgoliaSearch\Iterators\AbstractAlgoliaIterator->__construct() (Line: 346)
Algolia\AlgoliaSearch\SearchIndex->browseObjects() (Line: 708)
Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend->deleteSplits() (Line: 450)
Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend->deleteItems() (Line: 456)
Drupal\search_api\Entity\Server->deleteItems() (Line: 1338)
Drupal\search_api\Entity\Index->trackItemsDeleted() (Line: 216)
Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager->entityDelete() (Line: 51)
Drupal\search_api\Hook\ContentEntityDatasourceHooks->entityDelete() (Line: 142)
search_api_entity_delete()
y-steps-reproduce">Steps to reproduce
use the language split setting
add a new language, but do not add any content for it, this means it's not initialized in algolia
try to delete content or reindex
- go to /admin/config/search/search-api/index/
- press queue all items for reindexing
- reindex
In this case (with reindexing), it's caught in a try catch statement, so it's not fatal, but with deleting content it's fatal.
Proposed resolution
check if index exists before trying to delete content from it.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | search-api-algolia-3562746-3.patch | 1.47 KB | oknate |
| #2 | search-api-algolia-3562746-2.patch | 1.28 KB | oknate |
Comments
Comment #2
oknateHere's a patch to fix it.
Comment #3
oknateOK, in testing we need to test with index exists() function, not just that the object itself exists, here's an update.
Comment #4
davps commented@oknate, good catch, thanks for reporting the issue. I checked and found that the problem affects all data deletion cases:
Thanks for the suggested solution, but it will need to be updated to cover other cases. It would be great to have tests for these cases.
Comment #5
davps commentedComment #6
oknateComment #7
oknate