The datasource with ID ... could not be retrieved for index

Created on 15 June 2021, almost 4 years ago
Updated 29 May 2024, 12 months ago

Problem/Motivation

Seeing multiple error messages in watchdog while performing a search:
Drupal\search_api\SearchApiException: The datasource with ID '1oqsme--entity:node' could not be retrieved for index 'Global Search'. in Drupal\search_api\Entity\Index->getDatasource()
Everything seems to be working fine performing the search except for this error messages in the watchdog.

Steps to reproduce

This seems to happen if you use a Solr Server with setting "Retrieve result data from Solr" (retrieve_data).
(It is a scenario in which multiple Drupal instances use one solr core).
The "1oqsme" part of the datasource ID mentioned in the error is the hash of the instance in Solr.
It seems that Drupal cannot handle this datasource ID, because of the hash.

Proposed resolution

Skip "preLoadResultItems" in "preRender" if the Solr Server is configured as given above.

Remaining tasks

Provide a patch

πŸ› Bug report
Status

Fixed

Version

4.2

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany stefan.korn Jossgrund

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom 2dareis2do

    +1 #16

  • πŸ‡§πŸ‡·Brazil cassioalmeida

    Hi everyone,

    I started to face this issue with a Solr server on Pantheon. The search view started to present some errors, for example, the header was showing "Listing 1-16 of 44 result(s)" - but in fact, it was listing 12 items (not 16). Another issue was that I typed a random string (knowing this should result in an empty response message), but I still got the header showing a random results number.

    Then, I saw the error in the logs and found this thread. The comment #16 πŸ› The datasource with ID ... could not be retrieved for index Fixed fixed the issue.

  • πŸ‡ͺπŸ‡ΈSpain Carlitus

    Some problem, same solution.

    Also i had weird results like @cassioalmeida.

    And after you check the option "Retrieve results for this site only" you have to delete and reindex items in the index.

  • πŸ‡¦πŸ‡ΊAustralia pasan.gamage

    Thank you @kairus #16 worked.
    The setting is under /admin/config/search/search-api/server//edit
    and at the bottom of the page.

  • πŸ‡ΊπŸ‡ΈUnited States somebodysysop

    I am getting the error after my attempted update to Search API 8.x-1.37. Ticking "Retrieve results for this site only" is NOT working for me.

    I can't even uninstall Search API Autocomplete - get this error:

    Drupal\search_api\SearchApiException: The datasource with ID 'entity:group_content' could not be retrieved for index 'Solr sbn01 index'. in Drupal\search_api\Entity\Index->getDatasource() (line 373 of modules/contrib/search_api/src/Entity/Index.php).
    Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\suggester\LiveResults->calculateDependencies() (Line: 689)
    Drupal\search_api_autocomplete\Entity\Search->getDependencyData() (Line: 524)
    Drupal\search_api_autocomplete\Entity\Search->onDependencyRemoval() (Line: 489)
    Drupal\Core\Config\ConfigManager->callOnDependencyRemoval() (Line: 352)
    Drupal\Core\Config\ConfigManager->getConfigEntitiesToChangeOnDependencyRemoval() (Line: 43)
    Drupal\system\Form\ModulesUninstallConfirmForm->addDependencyListsToForm() (Line: 168)
    Drupal\system\Form\ModulesUninstallConfirmForm->buildForm()
    call_user_func_array() (Line: 536)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 19)
    Drupal\sbn\Middleware\Redirect->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    Any suggestions?

  • πŸ‡ΊπŸ‡ΈUnited States somebodysysop

    The solution I found that worked for me was to go to:

    1. /admin/config/search/search-api/index/{my solr index}/edit
    2. Tick Group and Group Relationship datasources.
    3. Save.
    4. Run whatever was failing OR (in my case) uninstall Search API Autocomplete
    5. Optionally go back and untick the Group and Group Relationship datasources if you don't need them.

Production build 0.71.5 2024