Better WordPress Search

One of WordPress’ weak points is its search.  Whenever you search for a phrase, it will just return all posts with that word in reverse chronological order.  People are used to the power of Google searches, these days seemingly having the ability to guess exactly where you want to go before you even finish entering the search query.  So, prompted by our Streetsblog editors, I set about to try and improve upon the WordPress default search.

Each time I look into this problem, the landscape is different.  Different plugins are available and Google offers different ways to hook into its API.  This time I was pleased to find a perfect way to offer Google search results on our blogs.  Using Google Custom Search, I created a search engine for each of our sites that restricts its results to just those from the site.  I then customized its look and feel via css in the Streetsblog style sheet.

I ended up with a solution that integrates closely into our blogs:

There are a few tips I picked up to accomplish this.  First, I changed the way we title our Streetsblog posts.  We used to use this format:

Streetsblog New York City » Hummer Going the Way of the Dodo

but I changed it to this format:

Hummer Going the Way of the Dodo | Streetsblog New York City

This way, the title of the post will be less likely to get truncated in search results, not just on our sites but on all Google searches.

Another key feature I made use of is turning off the Google ads.  Google Custom Search allows you to turn off ads if your site represents an organization that is exempt from taxation under section 501(c)(3).  This is found under the “Business Settings” of the search engine.

I kept our regular search widget in the sidebar but made it disappear when on the search page, at which point it is redundant.

Finally, I integrated Google Custom Search with our Google Analytics account to start gathering statistics on search usage.  It will be interesting to see what we can learn from this data.

2 Responses to “Better WordPress Search”

  1. vhamer Says:

    Nice! Search on Streetsblog has always been an annoyance for me. I use it for things like putting together case studies and coverage tidbits for press and grant applications. This setup is much nicer, and much easier to scan.

    One suggestion though: why not display more results on each page? I could easily scan 30 or 40 results per page without feeling overwhelmed.

  2. Chris Abraham Says:

    @vhamer, it doesn’t look like it’s possible to control the number of results per page. People have been asking for it so maybe in the future…