Improve your WordPress search
WordPress’ standard search isn’t all that good. One could say it sucks.
It sucks for several reasons; results come back in reverse date order, which makes sense for a blog but doesn’t exactly use any relevance. There’s no indication in the search results which words matched. The search just takes all the terms and does a basic sql query for any of them, so if you search for ‘i like cheese’ you get posts with the word like and then posts with the word cheese. You have no idea how many results you got.
Enter Relevanssi, a WordPress plugin which I just added and now;
Search results are ranked based on relevance.
Instead of an excerpt showing the first x characters of the post your get a relevant excerpt showing the part of the text that contains the search terms you used, and they’re highlighted in the text.
You see the search score which tells you which words were found in the text and how many time they were found.
A list of Relevanssi features:
- Search results sorted in the order of relevance, not by date.
- Fuzzy matching: match partial words, if complete words don’t match.
- Find documents matching either just one search term (OR query) or require all words to appear (AND query).
- Search for phrases with quotes, for example “search phrase”.
- Create custom excerpts that show where the hit was made, with the search terms highlighted.
- Highlight search terms in the documents when user clicks through search results.
- Search comments, tags, categories and custom fields.
- Adjust the weighting for titles, tags and comments.
- Log queries, show most popular queries and recent queries with no hits.
- Restrict searches to categories and tags using a hidden variable or plugin settings.
- Index custom post types and custom taxonomies.
- Index the contents of shortcodes.
- Google-style “Did you mean?” suggestions based on successful user searches.
- Advanced filtering to help hacking the search results the way you want.
The plugin comes in 2 flavors, free and premium. I’m half tempted to buy the premium just to support the free one as it is already quite feature complete. It’s also rather flexible and offers a lot of tweaking if that’s your cup of tea.