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, 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 the…

Read more Search results breakdown by type 31 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 in different installations. For that, you need a third-party search service, most of which…

Read more Multisite searches 141 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
Continue reading Using the relevanssi_hits_filter hook

Using the relevanssi_hits_filter hook

One of the most useful filter hooks in Relevanssi is the relevanssi_hits_filter, which lets you modify the array of posts Relevanssi finds. The filter passes an array, where index 0 gives the list of hits in the form of an array of post objects and index 1 has the search query as a string, in…

Read more Using the relevanssi_hits_filter hook 10 Comments on Using the relevanssi_hits_filter hook
Continue reading Using the relevanssi_where hook

Using the relevanssi_where hook

If you want to add extra filters to the search results, you can add them using a hook. Relevanssi searches for results in the _relevanssi table, where terms and post_ids are listed. The various filtering methods work by listing either allowed or forbidden post ids in the query WHERE clause. Using the relevanssi_where hook you can…

Read more Using the relevanssi_where hook 27 Comments on Using the relevanssi_where hook