Continue reading Taxonomy page search

Taxonomy page 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 in the options page. There’s also the option to choose which taxonomies are included. Currently the title of the taxonomy is…

Read more Taxonomy page search 49 Comments on Taxonomy page search
Continue reading Custom weighing with relevanssi_match hook

Custom weighing with relevanssi_match hook

If you want to fine-tune the post weights, version 1.4.5 introduces a new hook for that. 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…

Read more Custom weighing with relevanssi_match hook 64 Comments on Custom weighing with relevanssi_match hook
Continue reading Changing the number of search results displayed

Changing the number of search results displayed

A standard way to change the number of search results displayed is something like this: $myquery = "&posts_per_page=5"; $myquery = $query_string.$myquery; query_posts($myquery); $myquery = "&posts_per_page=5"; $myquery = $query_string.$myquery; query_posts($myquery); Unfortunately, this breaks Relevanssi. Relevanssi hasn’t played nice with posts_per_page in any case, for some reasons I don’t really understand — this is legacy code from…

Read more Changing the number of search results displayed 47 Comments on Changing the number of search results displayed
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 26 Comments on Search results breakdown by type
Continue reading Non-ASCII highlights

Non-ASCII highlights

Relevanssi has problems with highlighting terms when non-ASCII alphabet are used. The highlights don’t work with Cyrillic alphabet, for example. This is a problem with the regular expression I’m using to find the terms in the text. The regular expression uses word boundaries to find terms that are at the beginning or at the end…

Read more Non-ASCII highlights 5 Comments on Non-ASCII highlights
Continue reading Posts cannot be found, only one result per search

Posts cannot be found, only one result per search

Update: This bug is no longer relevant. Versions from Premium 1.3.2 fix this and the free version has never suffered from the bug. However, I’m not sure if an update to 1.3.2 fixes this. In this case, the instructions below fix the problem. If you’re having problems finding posts with words that appear in them…

Read more Posts cannot be found, only one result per search 0 Comment on Posts cannot be found, only one result per search
Continue reading Doing a multisite search

Doing a multisite search

Multisite search only works in Relevanssi Premium. Free Relevanssi can be installed in multisite environments, but it cannot search across sites. Installing multisite Relevanssi Relevanssi is a network plugin, so it only needs to be installed once on network level. However, you need to activate the plugin and build the index for each site. On…

Read more Doing a multisite search 141 Comments on Doing a multisite search
Continue reading Category title in the search results page

Category title in the search results page

If you’re using category restriction dropdown on your search form, here’s a bit of code that you can add to your search results template to show how many hits were found and what the category is. If no category was selected, this’ll just show how many hits were found. <?php $cat = get_cat_name($wp_query->query_vars[‘cat’]); $s =…

Read more Category title in the search results page 1 Comment on Category title in the search results page
Continue reading User profile search

User profile search

Relevanssi Premium can search user profiles. So far the following data gets indexed from user profiles: first name, last name, display name and description. If you’re interested in having something else indexed, there’s an option in the options page. Because WordPress only handles posts in the search result pages, Relevanssi must make WordPress believe it’s…

Read more User profile search 71 Comments on User profile search