Continue reading Using multiple custom taxonomies

Using multiple custom taxonomies

Usually, WordPress supports one category, one tag and one taxonomy in the search, if you use the query variables to set the taxonomies. You can enter multiple taxonomies as parameters to the query, but only the first one is used. If you want to have multiple taxonomies involved, you need to build a tax_query. The…

Read more Using multiple custom taxonomies 52 Comments on Using multiple custom taxonomies
Continue reading Using Relevanssi without a search term

Using Relevanssi without a search term

Deprecated: Relevanssi has long supported searching without a search term. These instructions are not necessary. Version 1.7.3 introduces the possibility to use Relevanssi without a search term. This is useful when you have extra query arguments that can be used to narrow the search, but which would be useful without a search term present. This…

Read more Using Relevanssi without a search term 42 Comments on Using Relevanssi without a search term
Continue reading Taxonomy archive search

Taxonomy archive search

This is a Premium feature and only applies when you index taxonomy terms. This does not apply in free Relevanssi. To include taxonomy pages (categories, tags, custom taxonomies) in the search, enable the option on the options page. There’s also the option to choose which taxonomies are included. By default empty terms (not linked to…

Read more Taxonomy archive search 49 Comments on Taxonomy archive search
Continue reading Custom weighing with relevanssi_match and relevanssi_results

Custom weighing with relevanssi_match and relevanssi_results

The relevanssi_match hook lets you modify the matches found for queries. It passes a match object, which has the post id ($match->doc), number of hits found in different parts of the post and the weight assigned to the post ($match->weight). Here’s how Relevanssi calculates the weight: Where $idf is the inverse document frequency, aka the…

Read more Custom weighing with relevanssi_match and relevanssi_results 64 Comments on Custom weighing with relevanssi_match and relevanssi_results
Continue reading Search results breakdown by type

Search results breakdown by type

Do you want to have a breakdown of search results by post type? This could be used for example to show a list of post types like books, movies, or albums on a review site, and make them links to limit the search results to that post type. This is fairly easy to do with…

Read more Search results breakdown by type 51 Comments on Search results breakdown by type
Continue reading Multisite searches

Multisite searches

Multisite search only works in Relevanssi Premium. Free Relevanssi can be installed in multisite environments, but it cannot search across sites. Relevanssi Premium can only support multisite searching across sites in the same multisite network. Relevanssi can’t search across multiple sites that are not in the same multisite installation. Cloud-based search tools can help you…

Read more Multisite searches 145 Comments on Multisite searches
Continue reading Direct access to the query engine

Direct access to the query engine

Relevanssi can’t be used in any situation, because it checks the presence of search with the is_search() function. This causes some unfortunate limitations and reduces the general usability of the plugin. You can, however, access the query engine directly. There’s a function called relevanssi_do_query(), which can be used to do search queries just about anywhere. Here’s a…

Read more Direct access to the query engine 61 Comments on Direct access to the query engine