Skip to main content
removed tags from the title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

search API: \Drupal\search_api\Entity\Index::load('INDEX_ID'); returns null

Bumped by Community user
Source Link

search API: \Drupal\search_api\Entity\Index::load('INDEX_ID'); returns null

I am trying to create a module that executes a search -- I tried to utilize the documentation for calling a search in code but

$index = \Drupal\search_api\Entity\Index::load('INDEX_ID');

gives me $index == NULL so the very second line

$query = $index->query();

blows it up. I tried replacing 'INDEX_ID' with 'default_index' but that didn't help. Search API is definitely enabled. Any idea why \Drupal\search_api\Entity\Index::load would keep giving me NULL?