WordPress is an amazing platform, it provides tons of features and flexibility, and gets better all the time.
One area that lacks though is the search functionality, it works but barely. You see it will find a word or a phrase but it doesn’t do it intelligently like Google’s search would.
If you want to find literal word matches then that’s just fine, but anything complex such as synonyms and you’re out of luck.
Also, WordPress’ search function doesn’t allow you to search outside of the post content, meaning things like comments are not searchable.
Another issue with it is that there is no way to do an advanced search, such as filtering by category, time period etc.
One more issue, just for good measure, is that results are also returned in chronological order, newest post first, which isn’t always ideal. Preferably you would want the most relevant content coming up first.
What can you do about it?
There are a number of plugins and services available to you right now that you can use to improve the search function on your site, and I will list them later, but now I want to show you how you can take the most powerful search engine in the world, Google, and make it your sites personal search engine.
What is Google Site Search?
Google provides a way in which you can leverage it’s algorithm just on your site. There are numerous options, starting at $100/year, but there is also a free version which is what we will be focusing on.
Head on over to https://www.google.com/cse/ and click the Create a custom search engine button in the top right.
It will then ask you for a list of sites to search, just enter your main site, but be aware of the different options listed below it. Generally you would want to use www.yoursite.com/* or if you have subdomains *.yoursite.com
Notice the asterisks (*)? Those are important, so make you you added them in, as they are wildcards which tells Google to search the entire site.
Select your sites default language and click Create.
Adding it to your site
The previous step created the search engine (easy right?), but now we need to actually add it to the site.
The next page you are sent to gives you some options, but click the Get Code button. Copy the code you get and then go to your site.
The easiest way to add it is to create a new page, click the Text tab so that you are not adding any formatting, and add an opening and closing div tag and insert the code in between and publish the page. It should look like this:
And on the front end, like this:
It is also possible to add it into your sidebar by creating a text widget and adding the code (with the divs) to it.
Using the search is of course just as easy as using Google, and a pop up will appear with the search results.
Auto-complete is enabled by default but it may take a little while before it starts working.
Using Google custom search is incredibly easy to do so if you are finding WordPress’ search to be a bit sucky give it a try!
If you need more control over the search results than what Google will allow (such as weighting certain posts to appear before others in the internal search results), then it’s time to consider a plugin.
Of course, being WordPress there are alternatives, some good, some bad, and some downright ugly. So here is a list of the best search plugins for WordPress in no particular order. Oh and all of these are free, or at least have a free option.
Expanding on the default search, Search Everything does what it says, allowing your visitors to search more than just the posts. It includes a wealth of options including: search highlighting, searching the taxonomies (categories and tags to you and me), exclude taxonomies, and more.
You need to sign up for an account with these guys and you only get one search engine (site) for free, after that it costs between $19 and $299 per month. It has a bunch of features include: auto-complete, page removal (from the search results) and the ability to reorder search results so you can make sure your popular searches show the articles you want at the top.
A great little search plugin, allows many complex search features such as partial word matches and OR, AND and quoted searches. Also has search highlighting, weighting and searches things outside of posts such as taxonomies.