Sphinx in WordPress

WordPress and Sphinx Search

You probably will agree with me that the standard WordPress search doesn’t even smell like search. I mean querying the database with the simplest LIKE query and sorting the results by date isn’t really a search. I’ve been keeping my eye out on Sphinx — an open source search server that works well with MySQL databases and I’ve finally had a chance to set it up for Theme.fm.

A few hours poking around the documentation and config files, I was not only able to get search results relevant to my search query, but also get it to search by taxonomies, and my favorite — the suggest tool. As seen in the image above I missed a few letters in my search query and Sphinx was able to correct me based on a dictionary from all the words in the site’s posts and pages.

It’s incredibly fast and easy to use once the configs are right. I hadn’t done any changes on the site itself, except a call to a “suggest” function for when no results were found. The rest was handled by a plugin I wrote that filters the native WordPress search. So I’m now thinking of a full-blown Sphinx plugin I could write that would generate Sphinx configs on the fly, build indexes and of course replace the standard search. Thoughts?

4 thoughts on “Sphinx in WordPress

    • Yaroslav, thanks for the heads up! I don’t see the suggest feature implemented but I’ll give it a spin on my virtual box. Thanks for stopping by!

Comments are closed.