A better search with Relevanssi Search Plugin

By default, the WordPress search engine doesn't include Breakdance's content because it's stored in a custom field. To fix that "issue", the best and easiest way is to use a plugin.

Relevanssi is Awesome!

Not only will Relevanssi solve this problem, it also has many other useful features. And most of them are free!

First, go to download / install the plugin : https://wordpress.org/plugins/relevanssi/

Then let's change the settings so it can work with Breakdance.

Go to the Relevanssi Search Settings page and in the Indexing tab, add breakdance_data as a custom field:


That's enough to make it work with Breakdance. But wait, check these other cool features.

Search hit highlighting

Go to the Excerpts and highlights tab, and enable the Highlight query terms in documents option.

Choose the Highlight type of you choice. For my example, I choose the CSS Class option, with the default class the plugin will add. So I can use the Breakdance's Selectors feature to style it.


I have added the .relevanssi-query-term class as a new selector, in order to style it:


From now on, when you use the search form and then click on one of the articles found, all the words on the page you're looking for are highlighted.

You can try with the search form below. Type 'parallax' and choose one of the articles found.

As you can see, all the 'parallax' words are highlighted, with our own style.


Works great with WP Grid Builder

If you use a Search Field facet from WP Grid Builder, you will be pleased to know that Relevanssi is supported in the Search Engine of the plugin.

Note that this feature is used in the homepage of Breakdance4fun and also Oxygen4fun.


The Stopwords feature

Because the breakdance_data custom field contains plenty of weird datas (so, not only the text of the page but all the structure in a JSON format), everything will be included in the Relevanssi index. So it will contain plenty of useless terms.


Relevanssi has an interesting option for dealing with this problem, which allows you to list all words that may be unnecessary, in order to remove them from the index:


Track everything

You can also track your users' searches on your website. It's really handy to know what they're looking for.


There are plenty of other features, but If you are looking for a simpler solution, you can also check this other plugin WP Extended Search.