Drastically improved search for jdhodges.com (WordPress based blog)

While using the internal search feature on my blog recently, I realized how worthless it was. As an example, searching for ‘exede review‘ came up with a bunch of mildly relevant results but by far the most relevant search result was on the second page. Not good. 🙁

Default WordPress search stinks

The reason this happened is that by default WordPress sorts search results by date. So if you happen to have some recent posts that contain a keyword, they will come up before far more relevant older results. 🙁

Likewise, WordPress themes generally show the ‘exerpt‘ for each item in the search results list. The search results page generally does NOT show you the specific portion of each result that is relevant to your search. So if you search for a term there is a good chance the search results page may not even have your keyword listed in the results that you are shown. 🙁

Finally, most themes do not highlight the search terms when you searh. 🙁

Can plugins save us? Yes

Thankfully, WordPress is known for its excellent plugins!  Some nice plugins came to the rescue and here is what I used to improve my website’s search results:

Relevanssi – A Better Search « WordPress Pluginshttp://wordpress.org/extend/plugins/relevanssi/Relevanssi replaces the default search with a partial-match search that sorts results by relevance. It also indexes comments and shortcode content.
Highlight Search Terms « WordPress Pluginshttp://wordpress.org/extend/plugins/highlight-search-terms/Very lightweight jQuery script that wraps search terms in an HTML5 mark tag when referer is a search engine or within wp search results.

The results are pretty amazing, here is a sample search:

Relevanssi based search on the left, old WordPress default search on the right

Relevanssi based search on the left, old WordPress default search on the right

This only shows a limited result set in the screenshot, but trust me the result ordering is DRASTICALLY better! 🙂

NOTE: for ease of comparison I had Highlight Search Terms* enabled for both the screenshot examples…

*Relevansii has highlighting options as well but I like the simplicity of the Highlight Search Terms plugin. 🙂

There are also oodles of other options in the Relevansii admin interface, this is just a small sampling:

Lots of cool options!

Lots of cool options!

WordPress rocks

So, this post is not about how sucky WordPress is. Rather, it is about how awesomely extensible WordPress is and how thankful I am that so many people have put so much time into crafting awesome code. It is another reason why I enjoy working on Weblogs.us, it is always exciting to see what people are going to do with their blogs next!

This week I will be donating to both plugin authors, but for tonight I need to get to bed!

A random side note: I did a fair amount of programming in college and law school for fun, for education and for work, but I have never written a WordPress plugin. I should probably do that soon, but unfortunately I have an awesome friend that happens to write great plugins so he generally does a better job than I could! 😉

Leave a Reply

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