Using the default database search index in drupal 8, when I search for a term from the a page title, sometimes it shows the result and sometimes it shows nothing, even though i enter the exact page title in the search. All pages have been indexed.

How can I debug why the search term is not being returned?

1 Answer 1


This is easy to debug, because the search index is built of rendered nodes with the view mode search_index. So you could build a view displaying all nodes with this view mode and check the result:

enter image description here


The node search plugin adds the title to the rendered node, so if the page title is the node label, it should be included in the search index:


  $build = $node_render->view($node, 'search_index', $language->getId());
  // Add the title to text so it is searchable.
  $build['search_title'] = [
    '#prefix' => '<h1>',
    '#plain_text' => $node->label(),
    '#suffix' => '</h1>',
    '#weight' => -1000
  $text = $this->renderer->renderPlain($build);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.