It was pointed out to me yesterday that WPLift doesnt have a search box and also that WordPress search is not the most reliable so this set me on a mission to find a solution. I constructed a search reults page and added a search box to the sidebar which is now functional. I tried out a few plugins and the one seemed to do what I wanted and is actively being updated and supported is called “Relevanssi” which is a free plugin which also offers a commercial one with more features. Some of the key features of Relevanssi are as follows :
- 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.
In this tutorial I will show you how to install and configure the plugin …
Install The Plugin
Download the plugin and then in your WordPress admin, visit “Plugins” > “Add New” > “Upload” and upload the file.
Once you have activated the plugin, you will see a new menu option under “Settings” called “Relevanssi” – click that and you can start configuring the plugin.
Build The Index
The first stage of setting up the plugin is to build the index for the first time, so go ahead and press the “Build the Index” button and the plugin will notify you when its done.
After building the index you can set some basic options for how search works – you can give different weights to the post title, tags and comments. You can set an operator of whether any of the search terms are present or if it requires all of them to be present. You can also choose whether to display newest posts at the top of the search results or the most relevent.
The next section allows you to keep a log of what people have been searching for and to exclude users from this log. I chose to keep a log – Im a stats junkie anyway but this will be interesting to see what people are searching for and could give me post ideas for the future.
Article continues after this block
Exclusions and Restrictions
Next up we have exclusions and restrictions, this allows you to limit the searching to specific categories and exclude categories and tags from the search results.
Custom Excerpts / Snippets
This section is where you can choose how many characters to include in your excerpt for the search results page. You can also show a number of hits for that search term next to in the results.
Search Hit Highlighting
This is where you can choose how to highlight the search terms in the results page, you can wrap <strong> tags around the result, change the font color or choose a background color.
The final part of the config screen is many options for how the plugin indexes your content – you can choose to include custom post types if you have them, include tags, shortcodes, comments, You can specifiy stop words – it also lists your 25 most common words from the database and allows you to add those as stop words also.
This seems like a good well-made plugin, I like the fact it keeps a log of searches on your site and the fact you can make it work with custom post-types is a big bonus. After trying a few searches on WPLift it seems to be a big improvement over the default search, so if search is important on your WordPress-based site, give it a go.