I had an issue before (Search API with views -> Apply filters) that has been solved already.

I have a website where i manage to create a database, display it with the views module and add a Search box with Search API.

The search module works great but i would like to know how can I make it to display a message when there's no match found. Something like "Your search didn't match any documents. Please try again."

Does anyone know how do I do that?

Thanks in advance!!

  • hmmm... have you tried or considered a custom tpl file if the UI isn't functioning like it should?
    – Geoff
    Jul 14, 2014 at 12:46
  • I made a copy of search-result.tpl.php to the root of my template with the following code: <div class="<?php print $classes;?>"> <?php if ($result_count) : ?> <?php print render($search_performance); ?> <?php print render($spellcheck); ?> <h2><?php print t('Search results');?></h2> <ol class="search-results"> <?php print render($search_results); ?> </ol> <?php print render($pager); ?> <?php else : ?> <p><?php print t('Your search yielded no results.');?></p> <?php endif; ?> </div> But nothing seems to work.
    – Drii7
    Jul 14, 2014 at 16:58
  • search-result.tpl.php is called for each search result of the core search module. You are bypassing that module by using search API and Views. You need to create a custom views tpl (api.drupal.org/api/views/theme%21theme.inc/group/…)
    – Geoff
    Jul 14, 2014 at 20:13

1 Answer 1


In Views, under the Advanced Tab, click on NO RESULTS BEHAVIOUR. There you can include a general statement (global text) when it returns nothing.

  • I did that but it doesn't work... I wonder if there's another way... Thank you!
    – Drii7
    Jul 14, 2014 at 8:34

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.