One of the only things that caused me to struggle when working with WordPress is the search feature. As a result, lots of people have taken the time to try to improve the functionality overall, but the issue I’ve got is a bit more rooted. Don’t get me wrong, I’m not trying to knock WordPress at all, but I’ve realized that in the past few months I’ve done nothing but sing it praises when in fact there’s always two sides to a story.
The fundamental issue
The underlying issue I’ve got with the WordPress search is it being database powered. In the time of of Widgets, dynamic content, and comments, a database powered search system is going to limit your results.
Plugin authors have done a lot to improve the situation by releasing improvements such as Search Everything and Search Unleashed. Both plugins offer a really great improvement to the stock WordPress search functionality by including important things like Pages, comments, and more. They give you a bit more fine-grained control over what shows up on a results page.
Unfortunately, though, the plugins don’t cover every base. Even though you can include categories and tags in the search algorithm, there will always be a bit more on the table in the form of dynamic content and widgets. Wouldn’t it be great if you could implement an on-page search system in WordPress?
Some time ago when working within a legacy content management system, I had to deal with a much more dire situation when it come to searching. The best I could do was link to Google and force the
site: flag to limit the search to the client website. Awful.
I know how to program, but writing a search engine from the ground up isn’t very high on my “Want to do” list. Luckily, the open source world again saved the day. I stumbled upon Sphider one day and I must admit, I was super impressed from the get-go.
Sphider is defined as:
Sphider is a lightweight web spider and search engine written in PHP, using MySQL as its back end database. It is a great tool for adding search functionality to your web site or building your custom search engine. Sphider is small, easy to set up and modify, and is used in thousands of websites across the world.
Perfect. After a two-minute installation I was up and running. I added the client site to the index, spidered the site, and was generating really awesome results in about 10 minutes overall.
Sphider and WordPress
It wasn’t until a few weeks ago when I found Sphider for WordPress – eureka! The plugin integrates Sphider to the best of its ability into the WordPress admin all the while making life a bit easier by piggybacking on WordPress’ database (removing the need for the quick setup). That really helps when moving a site from your development or staging server to production.
I can’t leave out a quick bit I discovered while poking around the Sphider forums and Sphider for WordPress page; the founding author is none other than Scott Kingsley Clark who is also responsible for Pods, my favorite WordPress plugin of all time.
Sure, a couple drawbacks
As with everything, there are drawbacks to implementing a system like Sphider. The benefit to WordPress’ search functionality being database-powered is its ability to be “live” — as content is updated, so are search results. With Sphider it’s a bit of a different story.
To update Sphider’s index, you’ll need to set up a
cron job to periodically re-index your website. I typically set up a job to run every few hours on highly dynamic websites, or let it go to once a day on less busy projects. At worst, a search query may be outdated by a few hours which really isn’t a deal breaker when you consider how much more targeted the results are.
A great solution, a great service
While the WordPress default search isn’t the sharpest tool in the shed, it can be greatly improved with a plugin or two. If you’re looking to really raise the bar, I’ve found Sphider to be a completely capable solution, even though there are a couple minor drawbacks.
It’s a great service to offer your client if their website is content-heavy as well. Improving the available search functionality will help them by helping their website visitors to find the content in question that much faster.
What are your thoughts on the default WordPress search functionality? Should Automattic work to include something like Sphider in WordPress core? Should it be left up to plugins? Is it worth looking into when people are more likely originating from a search engine anyway? What do you think?