Pretty much any website created in WordPress will benefit from having search functionality. Whether your site is a blog, an informational website or an e-commerce site, allowing users to search the database directly saves them time and improves usability.
Unfortunately the default WordPress search widget leaves a lot to be desired. Here are just some of the areas in which the default WordPress search function is lacking:
- Search is too broad and returns too many pages, many of them irrelevant to the original search
- Search results are ordered by date, not relevancy
- No option to use Boolean search operators like AND, OR and NOT
- Excerpts shown on search page often have no relevance to the search terms
- Search terms are not highlighted in the returned results
- Misspellings and typos aren’t recognized
- Limited scope – only searches post titles and content and not tags, categories, etc.
For a small site, this may not be much of a problem, but the more pages and posts you have on your site, the more poorly the default search widget seems to perform. For large sites, it is next to useless.
Luckily you do have other options and there are a variety of plugins that offer much improved search functionality and a better user interface.
Relevanssi is my personal preference for a search widget that is easy to use, works well and has many useful features. The basic version of Relevanssi is free and there is also a premium version available that works on multisite and has other added features.
Relevanssi free edition includes the following features:
- Orders search results by relevance, rather than date
- Has fuzzy matching capability to provide partial match of search terms
- Can use AND and OR operators
- Ability to search for “exact phrases”
- Creates custom excerpts with the search term highlighted
- Highlights search terms in results
- Allows comments, tags, categories, and custom fields to be searched.
- Allows weight adjustment of titles, comments, and tags
- Logs queries
- Improves search with stop words
- Integrates with WPML and Polylang
- Offers “did you mean…” suggestions for misspellings.
The premium version also offers:
- Ability to search user profiles, taxonomy pages and MySQL columns
- Highlights search term matches from Google and other search engines
- Ability to change operator on the fly
- Allows weight adjustment by post type, taxonomy, post date and manually, with a filter hook
- Multisite support
- Throttling to improve performance on large databases
- Assigns extra weight to new posts.
Not only does Relevanssi give better search results in a more user-friendly format that the default WordPress search, but it’s also much faster – a must for large sites.
The weighting feature is particularly useful. If your post titles are generally very relevant to the content of your post, for example, you have the opportunity to give them the heaviest weight so that posts found with search terms in the title are judged to be more relevant than those with search terms in their content but not in the title. You can also lower the weight of things like comments that may not be relevant to the rest of the content.
SearchWP is another highly recommended plugin that adds a lot of features to the basic WordPress search. This plugin includes many similar features to Relvansii and some extras, including:
- PDF indexing
- Integration with bbPRess forums
- Use of supplemental search engines
- Weight control including title, content, custom fields and taxonomies
- Easily exclude or attribute results
- Search statistics
- Multisite support
- Boolean search
- Fuzzy matching
- Live search
- Term highlighting
- WPML and Polylang integration.
A single site license will set you back $29 which may seem a bargain when compared to Relvanssi, however the license requires renewing annually. This may still be a good choice for you if you need some of the added functionality, say for example you have a lot of PDF documents on your site that need to be searchable.
Tracking Search Terms
Another feature that the default WordPress search doesn’t offer is the ability to track the terms that people are searching on your site. This can help you to find your most popular content, get ideas for new posts, and help you to optimize your navigation so It’s more user friendly.
Most of the advanced search plugins, like Relevanssi and SearchWP include search logging and statistics. You also have the option of using Google Analytics, which also allows you to combine the statistics from search with your other website statistics for advanced analytics.
Setting up Google Analytics to log your site searches is very easy. You just need to log into your Analytics account and edit your profile information to make sure site search is being tracked. You’ll need to enter the query parameter, which is the letter or word appended after the “?” in the address bar of your browser when you do a search on your site. For the default search, this is “s” other search plugins may use a different parameter.
Using Google Custom Search
Another option to using one of the search plugins above is to piggyback off a search engine that you know delivers good search results. Google search results can be manipulated and as their algorithm evolves, they don’t always get things right, but they’re arguably the most accurate search engine available today and certainly the most popular one.
You can integrate Google Custom Search into your WordPress site, which not only improves your search results, but also gives you the opportunity to earn a bit of extra cash through Adsense if a user happens to click onto a sponsored search result when on your site.
Even WordPress.org uses Google custom search for its search functionality, which says something about the accuracy of WordPress search results!
You can integrate Goggle custom search either by installing a plugin or by pasting into the code to a widget or page template. In both cases you just need to supply the name and URL of your website and you have some basic customization options to help the search results integrate more seamlessly into your site.
You can improve the results from Google Custom Search by promoting certain pages to the top of the search results and by defining auto-completions and synonyms.
The only issue with Google search is that it relies on your pages being indexed with the search engine before they can be found. This usually happens quickly and isn’t an issue but it can sometimes mean there is a short delay before newly published content shows up in search results.
If you don’t want to display sponsored listings in your search results and risk users clicking off your site, you need to buy a license for Google Site Search. This currently costs from $100 per year.
The default WordPress search functionality certainly needs some work and we can only hope that this will be addressed in future updates of the WordPress core code. Until this happens, there are luckily several excellent plugins available that deliver fast, accurate search results for even the largest sites.
Do you use the WordPress basic search, Custom Google search or one of the plugins mentioned above? Is there another plugin that you recommend? Please share your ideas and suggestions in the comments.