The core Search Module builds and maintains an index of words found in the nodes and users of your site. You can control a few of its indexing behaviors, and in this video, I will walk you through those settings.
But first, we need to create users and content on our site to be able to perform a search. I am going to use the Devel Generate module to quickly generate 10 users and 50 pieces of content with comments.
Now that we have users and content on our site, let's go to the core Search module settings
- Go to "Configuration => Search and Metadata => Search settings"
- Indexing status (This shows how much of your site has been indexed and is available to be searched. Currently, 0% of this site has been indexed.)
- Re-index site (This will dump the old index and create a new one.)
- Indexing Throttle
- Number of items to index per cron run: 100 (Cron takes care of a variety of tasks at specified intervals like indexing content for search. Here we can specify the number of items to be indexed with each cron run. The more items we index, the more memory and resources will be needed to perform the index which may cause timeouts and memory errors while indexing. So, it is recommended to set a value here appropriate to your system. Cron runs with the default frequency of every three(3) hours, but we can manually run cron by going to "Configuration => System => Cron" (admin/config/system/cron) and clicking the "Run cron" button. Then when we go back to "Search settings" and refresh, we'll see that the indexing status says that 100% of the site has been indexed)
- Index settings
- Minimum word length to index: 3 (This allows you to specify the minimum number of characters a word has to have to be indexed)
- [x] Simple CJK handling (This is for sites which use the Chinese, Japanese and/or Korean languages. This does not affect other languages.)
- Active Search Module (Two search modules are included with Drupal. They allow you to search nodes and users.)
- [x] Node (This will search node content.)
- [x] Users (This will search user profiles and if you have sufficient permissions, will search for users' email addresses.)
- Default search module (Since both Node and Users are enabled in the settings above, search module will render the results into separate result tabs, one for nodes and one for users. The Default search module setting lets you set the default search result tab.)
- [x] Node (This will make the tab for nodes active by default)
- [ ] User
- Content Ranking (This allows you to modify the order in which results are returned during a search process, and help direct Drupal to what is relevant to your users. A higher number means higher relevancy.)
- Content is sticky at top of lists: 5 (This will make sticky content show up before other content.)
- (Save Configuration)
Finally, in order for users to be able to access the search functionality, we need to give them permission.
- Go to "People => Permissions"
- Scroll down to Search
- Grant "Use Search" permission (and optionally, "Use advanced search") to:
- [x] Anonymous user
- [x] Authenticated user
- (Save permissions)
Now, I'll go to homepage and enter an article title in the search box and click the search button.
Now we have the search results page with two tabs (the nodes and users tabs), and you'll notice that we also have the advanced search option. With Advanced Search you can also look for content containing "any of these words", "the phrase" or "none of the words" and you can filter results based on content type. As I mentioned in the introduction to this series, the features of the core search module are limited. So to provide a great search experience to this site's users, we're going to use the Search API module as an alternative search solution on this site.
In the next video, I will show you how to set up the Search API module.