DRUPAL 8 | Limit search by content type

September 28th, 2018

For standard search page:

Download and install “Search Exclude” – https://www.drupal.org/project/search_exclude
Configure it , by open “/Configuration/Search” and “Metadata/Search” page.

Scroll bottom to Search Pages.

Under “Page type” select “Content (Exclude)” and click “Add search page”.

Under “Path” insert the url slug that you want that the search page have.

Under “Exclude content type” select the content that you want exclude form search results.

Save

Now you need to “re-index the site” under¬†/Configuration/Search and Metadata/Search page, click “re-index the site ” on first block “Progress of the indexation”.

For Re-index the site, drupal, need to runs cron.

For do that open “Configuration / System / Cron” and, or attends that the cron runs on the interval you have set before, or click “Execute cron” that run cron immediately.¬†

When cron finish, you can go to the search page ( the one inserted before, on the Search page creation ), and made a search, if all it’s right you are searching only inside the content type you have selected.