As far as I see, the search api has no effect on the existing search. The video about State of Search Drupal 8 - Basic Usage of Search API indicates that you have to supply an own view for the search results.

Isn't there a way to configure the existing search system to exclude content types and/or nodes from the search index?

  • do you got some advance? May 3, 2017 at 2:57
  • @AdrianCidAlmaguer unfortunately not :(
    – Alex
    May 4, 2017 at 8:57

3 Answers 3


There is a new Search Exclude (Node) module

Exclude content types from node search for Drupal 8.

enter image description here


In D8 you can use the following code to alter the core node search. The following code would restrict the node search results to 'article' content type. You should be able to use any conditions here you like.


 * @file
 * Module that alters search queries.

use Drupal\Core\Database\Query\AlterableInterface;

 * Implements hook_query_TAG_alter(): tag search_$type with $type node_search.
function MYMODULE_query_search_node_search_alter(AlterableInterface $query) {
  // For testing purposes, restrict the query to node type 'article' only.
  $query->condition('n.type', 'article');

Hope this helps.



Drupal Custom Search will allow you to prevent Content Types from getting in the default Drupal Search https://www.drupal.org/project/custom_search

  • but they still get indexed, right?
    – Alex
    Jun 8, 2016 at 13:20
  • Correct, but you can choose to block them from results. Jun 8, 2016 at 13:30
  • Thanks for the info. Do you know if module sufficiently checks if the url parameters only contain content types you have not excluded in the block?
    – Alex
    Jun 8, 2016 at 14:07
  • @Alex I can't speak for the D8 version, but the D7 version alters the search query directly to either include/exclude the content type configuration, based on your settings. So, those results would never show up, regardless of where you are using them.
    – mpdonadio
    Jun 8, 2016 at 15:32

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.