Drupal search not working-How to fix?

You just installed Drupal for your company’s website, but the search bar is not working. You’ve been searching through the sites and forums on how to fix this issue, but nothing seems to work. The search bar is totally blank with no results found. This blog post will show you how to fix your Drupal site if your search is not working.

Drupal is a free open-source content management system (CMS) built using PHP and MySQL. It can be used as a web application framework or as an alternative to WordPress or other systems like Joomla!

When your Drupal site search doesn’t work, it can be frustrating to figure out what’s wrong. Here are some common reasons why the search might not be working and how you can fix them.

-The database is down or inaccessible: If your database is down, this will cause a problem with searching on the site. Check for errors in MySQL by running “show status;” from command line or phpMyAdmin. You should also check whether Apache accesses the database properly by checking error logs at “/var/log/httpd” directory.

-Drupal has been updated without rebuilding index first: Indexing text fields automatically after updating Drupal core is important to make sure search works as expected.

First, make sure you are using the latest Drupal version.

If you find that your Drupal is outdated, check the announcements page of drupal.org to figure out what version is latest and then upgrade it by following the appropriate steps on that page.

After updating your Drupal core, rebuild the index from the Admin menu by going to “Configuration -> Search and metadata -> Search index” as shown below:

Then clear the site cache from “Configuration -> Performance -> Clear all caches” as shown below:

-Drupal has not be configured to use search at all. Drupal provides a large number of modules that allow you to add various functionalities to your website. You need to ensure that Search, Meta tags and Titles are enabled on your site from “Modules” from Admin menu as shown below:

After enabling Search, Meta tags and Titles modules, please rebuild the index as explained before.

-Javascript/Ajax search is not enabled: this is a problem caused by several different modules combined. You can fix it with either disabling or removing those conflicting modules until you find which one is causing the issue.

-Search index is corrupted: Drupal 8 core does not provide a way to rebuild search index although it can be done through 3rd party modules like Views Datasource . However, this would only fix the problem temporarily, you will have to regularly check for updates of that module or do it manually when

Check to see if your search index has been updated by running a cron job.

To run cron, go to “Configuration -> Cron” as shown below:

By default, Drupal runs a daily cron job. You can also create your own cron jobs by going to “Add new content” from the top right corner. Run the following command after creating a custom cron job:

If you receive an error message, then your Drupal is not updating the search index. You can try running “rebuildsearchindex.php” from command line as shown below:

If you receive an error message such as “MySQL server has gone away”, your MySQL server name might be misspelled or private IP address of mysql server might not be added to hosts file on the server. You can fix it by adding MySQL’s private IP address to hosts file or changing the connection details of your database in settings.php file.

If you receive an error message such as “Can’t connect to… “, this means that indexer process is not running on the server. It could be for various reasons, but most often it is because indexer process has been disabled. You can check it by going to “Search and metadata -> Manage indexes” in Admin menu as shown below:

If you find all your Drupal indexes have a status of disabled, please enable them one by one after making sure each does not interfere with another .

-Some fields are indexed twice: this is a problem caused by some modules. You can correct the indexing on “Fields” from Admin menu as shown below:

Check for any conflicting modules which might be causing indexed fields to be added twice and then disable or remove that module. If you need help, please post it in Drupal Answers .

-Different languages and geographic regions are indexed separately: this is a problem caused by the Language module which enables different languages for search. You can fix it with disabling “Language” from Admin menu as shown below:

Please note, this might have an adverse effect on your website so you should think twice before doing so. If you need help, please post it in Drupal Answers .

-Another problem might be caused by the Presence module which adds a status message to your nodes. You can correct it by disabling “Presence” from Admin menu as shown below:

If that doesn’t work, try making some changes to your Apache configuration file.

If you are using PHP 5.6, make sure that your Drupal is running with at least PHP 5.5 (both versions cannot be installed together). To check the version of PHP you are running, run php -v from command line as shown below:

If that still doesn’t work, then it is likely an issue with PHP settings on your server and not Drupal’s fault.

In this case, please raise a support ticket with your web hosting company giving them the following information:

a) Basic server configuration (Operating system, CPU, RAM, Swap space).

b) Apache or Nginx version.

c) Any relevant Apache modules enabled on server which might be causing a conflict.

d) Current nginx config file (if you are using nginx)

e) Path to web root directory.

f) Error logs related to this issue. Please note, it is very important that you provide all the above details because fixing this problem requires an investigation of server’s filesystem and configuration if found faulty .

Try clearing cache in admin > performance module.

To clear cache, go to “Performance” from Admin menu and click on the “Clear all caches” button in the top right corner.

If that doesn’t work, then try clearing cache of specific elements by browsing through different menus. Here is an article which might be helpful: Clearing Drupal’s caches .

Try disabling all modules.

To disable all modules, go to Administration > Modules and click on “Uninstall” tab. Select the modules you want to disable for this particular session and then click on “Disable selected modules” button at the bottom.Try enabling the modules one-by-one and find out which one is causing this issue

Clear browser cache.

This can be done by pressing CTRL+F5 on most browsers.

By Muthali Ganesh

I am an engineer wih a masters in business administration from Chennai, India. I love discovering and sharing hacks.