There is an incredible module for Drupal 8 that allows you to make a custom search engine for Drupal. It is called the Search API module, it is very extensible. I will show you how to add this to your site and get it setup. I will only be covering a basic setup. There is so much more that can be done with this. It is worth taking time to reach the documentation on this page: https://www.drupal.org/project/search_api.
I did make an amateur mistake in my approach and left it in the video. I do correct myself and it became a great learning moment.
- Install Search API Module: https://www.drupal.org/project/search_api
*Make sure to uninstall the Search Module that comes with Drupal 8 if it is enabled
- Enable: Database Search, Database Search Defaults, Search API
- Adjust Database Server and Index to your website needs: admin/config/search/search-api
- Be sure to index the content by clicking index now: /admin/config/search/search-api/index/default_index
- Go to admin/structure/views add View
- Set a View name
- Change View Settings Show dropdown menu to Index Default content index *this changes according to how you name your index on the Search API page see step 2.1
- Checkbox make a page and set the title a slug
- Click Save and Edit
- Add to Filter Criteria:
- Fulltext search – Exposed to visitors
- Make any other changes and click Apply
- Content datasource: Publishing status – click Apply
- Under Exposed Form set the following
- Exposed form in block: Yes
- Exposed form style settings: Change Submit button text to Search and uncheck Allow People to choose sort order and click Apply.
- Add fields or make other adjusts for your search results
- Click Save
- Goto: admin/structure/block
- Find the exposed form click Place Block in a region
- Click Save Blocks
Do you like coffee when you code?
Grab our coffee mug!