Integrate search facets with the Relevanssi search plugin. Relevanssi greatly improves the quality and relevancy of search results by maintaining its own search index in the database.

Setup

When the Relevanssi integration add-on is activated, each search facet will have a new “Relevanssi” choice within its Search engine setting.

Make sure to set your Search facets to using this new “Relevanssi” engine, otherwise they’ll likely return no results (due to Relevanssi short-circuiting core search).

Turning off results snippets

Some users have reported issues with Relevanssi’s custom search results snippets feature.

Relevanssi limits

Be aware that using Relevanssi may require large amounts (hundreds of MBs) of database space (for a reasonable estimate, multiply the size of your wp_posts database table by three). If your hosting setup has a limited amount of space for database tables, using Relevanssi may cause problems. The following information is from the Relevanssi site:

“The upper limit of how big a site Relevanssi can support depends on your hardware. On shared hosting accounts with limited resources, tens of thousands of posts can be too much. If your hardware is solid, especially your database, there’s probably no upper boundary. The biggest site we’ve heard run Relevanssi without problems had two million posts, using a dedicated database server with SSD drives.”

Relevanssi, WooCommerce and product variation SKUs

If you are using Relevanssi with WooCommerce, with product variations enabled, you may run into issues when searching variation product SKUs with the Search facet.

Relevanssi can index product and product variation SKUs for WooCommerce products: just add _sku to the list of custom fields to index. But Relevanssi will index SKUs for the variations only, so the parent product will not be found when searching for the variation SKU.

The following code (source) uses the relevanssi_content_t o_index filter hook to index the product variation SKUs for the main product, so you will be able to find the parent product when searching for the variation SKU.