Sufyan bin Uzayr April 17th, 2013

Improving the Default Search Experience in WordPress

No matter what the genre or niche of your website is, the search functionality forms an integral part of your site. In fact, it is almost impossible to think of the internet without the search function. A search bar helps your visitors to easily locate content on your website and as a result, plays a crucial role in converting casual visitors to regular subscribers. Sadly, the default search functionality in WordPress leaves a lot to be desired. Agreed, WordPress offers out of the box search function and you can easily add a search bar to your sidebar using widgets, but the overall performance of the WP search mechanism is below par, to say the least.

In this article, we shall be taking a look at the drawbacks of WordPress’ default search mechanism as well as useful tools that can help you get the most out of it.

Taking A Closer Look at WordPress Default Search

The Limitations of WordPress Search

“WordPress default search kinda sucks.”

-- Joost de Valk

Well, I guess that sums it up? The default search in WP misses out on many crucial areas. In fact, WP default search is so disappointing that even WordPress.org does not use it -- try a search using the bar in the header at WP.org; you will notice that the results are provided using Google custom search.

At the very basic level, WP search looks for your queries in the published posts and pages -- literal matches primarily. Almost all CMSs come with a default search functionality and if I may say so, WordPress’ search fares way worse than that of most others. All said and done, WordPress needs a better search algorithm.

Oh, and wait, we are not yet done talking about the limitations of WP search.

  1. Currently, the search function in WordPress lists the results chronologically, that is, the most recent posts come at the top, followed by the older ones. However, I feel that a better choice will be to arrange the results on the basis of relevance. The basic purpose behind any search is to locate information or content that is relevant to the specified keywords, and a chronological search can make you browse through several irrelevant posts if the actually relevant one is buried below the newer articles.
  2. WordPress search does not allow the users to specify advanced parameters. You cannot refine your search, search inside a given category or search within a search. Similarly, you cannot filter search results either.
  3. Also, WordPress only searches for the specified keywords within posts. It does not include the comments in its search -- this is a rather strange exclusion considering the fact that WP evolved as a blogging platform and the comments section of a popular and active blog can hold a great deal of useful information.
  4. Unless your theme provides this functionality, keywords are not highlighted.

Overcoming The Limitations: Useful Plugins

1. Relevanssi

Relevanssi is a useful plugin that replaces the default WP search with a partial-match search. It can sort results on the basis of relevance, and even search within comments, tags, categories, custom fields and shortcode content.

relevanssi

The plugin lets you filter results, search within custom taxonomies and even displays a Google-like “Did you mean...” section with search results. The plugin also has a premium version which comes with user support, multisite support and spelling correction.

2. Dave’s WordPress Live Search

Dave’s WordPress Live Search lets you implement “live search” on your site using the default search function and jQuery.

http://www.youtube.com/watch?v=7CGR2bJ1mLM

Basically, this is your website’s version of Google Instant -- results are queried for and produced as soon as the user starts typing in the search box. The plugin is internationalization ready.

3. Search Everything

As the name suggests, Search Everything lets you include sections of your site that are otherwise omitted from search results. This plugin can search within pages, custom post types, custom taxonomies, comments, attachment post types, excerpts, categories, custom fields and tags.

search-everything

You can also specify parameters such as “search within approved comments” instead of “search all comments”. The plugin also lets you highlight keywords in search results.

4. Better Search

Better Search plugin replaces the default WP search and employs a contextual search mechanism that sorts results on the basis of relevance. The plugin is not really popular, and has had only 15,000+ downloads (compare this with the 322,870+ downloads of Relevanssi). Also, Better Search has not been updated for almost a year.

5. WP Search

WP Search also sorts results on the basis of relevance. It supports Boolean operators and wildcard characters. Sadly, the plugin is compatible up to WP version 3.2 only, and has not been updated since October 2011.

Additional Resources

1. Using Google Custom Search

What? You actually thought you’ll finish an entire article talking about “search” without reading about Google?

Using Google Custom Search, you can easily add a Google-powered search box to your website.

http://www.youtube.com/watch?v=Qd9z48Bo8ZA

There are two ways to implement Custom Search on your WordPress blog.

The first method lets you accomplish the task without using a plugin. Simply navigate to the Google Custom Search page, and create a custom search engine. You will need to provide basic details such as your website URL, etc. and then Google will generate a search ID for you. Thereafter, you will be presented with a piece of code that you can copy and paste wherever you want the search box to appear (say, in your sidebar using the arbitrary text widget). That is it, you are good to go (though it will take sometime before Google bots actually index your entire site and results start showing up).

The second method is to use the Google Custom Search plugin. Install, activate, head to plugin’s settings page, and specify your unique search ID. All done! You can place the search box in a widget or even as a pop-up dialog.

2. Swiftype

Swiftype is a full-fledged search mechanism for websites and mobile applications. It comes with its own detailed search analytics, developer API and has support for mobile devices.

https://www.youtube.com/watch?v=pITuOcGgpBs

Considering the fact that Swiftype also caters to mobile apps, it is backed by SDKs for Android and iOS.

Search results are sorted on the basis of relevance, and you have the ability to overrule the sorting and specify your own custom ordering. While Swiftype can be used by any website irrespective of the CMS, it also comes with a WordPress plugin to make integration easier.

swiftype

Swiftype comes with both free and paid plans. The cheapest premium plan costs $19 per month and lets you have 2 domains, perform 1,000,000 monthly search queries and view analytics for past 30 days. There are other plans available as well suited for bigger sites and power users.

http://www.youtube.com/watch?v=rukXYKEpvS4

Naturally, unless you can manage with the free version (which will not have support and offer a much lesser number of monthly queries), you will have to invest a decent amount of money in order to use Swiftype.

Verdict

So, which service should you use?

In general, the Relevanssi plugin fares way better than most others in its league. I tried only the free version, and it does manage to improve the search experience overall. You can use it alongside Dave’s WordPress Live Search to deliver quick results as well.

The Search Everything plugin does a good job of include sections of your site that are left out by the default search. However, it does not do much to improve the overall search mechanism, nor does it raise the relevance of search results.

If you do not want to install another plugin, Google Custom Search will be your best bet. Agreed, it may not have all the fan-fare associated with some of the plugins listed in this article, but at the end of the day, Google does what you want it to do -- deliver amazing search results.

Swiftype is another terrific option when it comes to custom solutions. However, having a free plan with severe limits on the number of queries does not sound good to me -- what if you have a traffic hike and your visitors search your site, only to find out that the search is not working because you did not pay for it? Plus, $19 per month is an amount that can pay for almost 4 months’ hosting for those who are using a shared server. This simply shows that Swiftype is not a tool for the everyday casual blogger. On the other hand, if you have the budget and can opt for the paid plans, go ahead! Swiftype is worth the investment if you have a large site.

What do you think of these tools to help you boost the search functionality on your website? Have your say in the comments below!

(dpe)

Sufyan bin Uzayr

Sufyan bin Uzayr is a contributor to a variety of websites and blogs about technology, open source, web design, content management systems and web development. He is a published author, coffee lover.

11 comments

  1. Hey, thanks for the detailed write-up! I just wanted to offer a couple of clarifications on behalf of Swiftype that I believe are important. First, we absolutely support our free users. Everyone in the company is part of the support team and we pride ourselves on quick resolution of questions, even on free accounts. Also, our plan limits are soft, meaning if you have a huge spike in traffic, we aren’t going to just turn off your service. Our goal is for you to have a positive experience every step of the way, and that simply would not make sense for us to do.

    If you have any questions, please feel free to email me directly: [email protected]

    Best,
    Quin

  2. Great review! Searching is often an after-thought, only after many posts have been added and now I can’t find them!

  3. Pingback: Tweet Parade (no.16 Apr 2013) | gonzoblog
  4. Thanks for the nice tools to improve search experience in wordpress. But I really recommend Google custom search because its also very effective for ranking.

  5. One alternative not mentioned is a PHP search engine not incorporated into WordPress. For example, my WordPress site relies on the Sphider search engine. While the Sphider WordPress plug-in appears to be defunct, I have been able to use the freestanding version of Sphider, and then use the header and footer templates incorporated into Sphider to give the search page the look and feel of my WordPress site. I’ve even tweaked Sphider to use PHP Mobile Detect so that it will use the same separate themes for desktop and mobile devices that my WordPress site does.

    In addition to providing more relevant search results, Sphider provides a couple of other advantages important to me. First, I’ve got two separate WordPress sites (one for my law firm, the second an educational site in my area of law), and wanted the search function to search both of them simultaneously. Second, I’ve tweaked my header.php, content.php, and content-single.php files so that my custom post types often have titles that link to their main archive pages. For example, my Accounting page is an Employee Benefits Library custom post type. Its tag is Employee Benefits Library: Accounting, and the title shown on the page is Employee Benefits Library: Accounting (with Employee Benefits Library being a link to the main Employee Benefits Library archive page. These custom titles are not reflected in the titles used by the default WordPress search, but are picked up by Sphider.

  6. What I miss the most with default search in WordPress is keyword highlighting on the result pages / posts and a more intelligent excerpt that would show excerpt containing that searched keyword.

    Thanks to your article I found Relevanssi plugin which does exactly that, although I had to modify plugin code a little since intelligent excerpt feature was not working properly in some occasions.

  7. Thanks for a very helpful summary. I’m going to give Google Custom Search a try. BTW, I note that Swiftype now starts at $49 per month (currently discounted at $44.)

  8. I’m using the combination of Relevanssi with Dave’s Live Search. The search results match up fine, which is great. The issue I have, though, is that the excerpts shown in Dave’s Live Search is just the “first X characters: rather than the Relevanssi excepts that have the part of the text where the search term was found.

    Any ideas on how to address that?

    Thanks!
    Brian

  9. Good writeup. We are debating between keeping Relevanssi or switching to a third-party off-site option like Google or SwiftType. On-site search can hurt performance for websites our size.

Leave a Reply

Your email address will not be published. Required fields are marked *