Continue reading Adjusting search throttle

Adjusting search throttle

If Relevanssi Premium causes out of memory problems, make sure you have the “Throttle searches” option checked. However, if that doesn’t work, and you’re still getting out of memory issues, you can try making the throttle tighter. The limit can be adjusted by adding this line to your theme functions.php file: You can adjust the…

Read more Adjusting search throttle 0 Comment on Adjusting search throttle
Continue reading Most important Relevanssi debugging trick

Most important Relevanssi debugging trick

When you have problems with Relevanssi, these are the first steps to take: Make sure you have the latest version of Relevanssi. If not, upgrade. Try deactivating the plugin and reactivating it. Are you using Yoast Local SEO? Read this. Try deleting the plugin and reinstalling it from scratch. If that doesn’t help, then approximately…

Read more Most important Relevanssi debugging trick 270 Comments on Most important Relevanssi debugging trick
Continue reading Setting post_type to page doesn’t work

Setting post_type to page doesn’t work

For some reason setting the post_type query variable to page doesn’t have the desired effect. Other post types (post, custom post types) work, but page doesn’t do anything. This is not a Relevanssi bug, but a WordPress feature (see this trac ticket). If the user inputs a bad value to the post_type query variable, WordPress…

Read more Setting post_type to page doesn’t work 0 Comment on Setting post_type to page doesn’t work
Continue reading Filtering results by category

Filtering results by category

In order to filter search results by category, use the following code: $url = get_bloginfo(’url’); $url = esc_attr(add_query_arg(array(’cat’ => ’10’, ‘s’ => get_search_query()), $url)); echo "<a href=’$url’ rel=’nofollow’>Filter by category 10</a>";$url = get_bloginfo(‘url’); $url = esc_attr(add_query_arg(array(‘cat’ => ’10’, ‘s’ => get_search_query()), $url)); echo "<a href=’$url’ rel=’nofollow’>Filter by category 10</a>"; Put this in your search results…

Read more Filtering results by category 27 Comments on Filtering results by category
Continue reading Related searches feature

Related searches feature

John Blackbourn wrote a cool related searches feature for Relevanssi Premium. It’s included from version 1.7.4. In order to use the related searches, you must have search logging enabled and a good log of past searches. Then add the following code to your search results template in a suitable place: The first parameter is the…

Read more Related searches feature 19 Comments on Related searches feature
Continue reading Using Relevanssi without a search term

Using Relevanssi without a search term

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 was originally implented for a restaurant search, where the users can search for restaurants based…

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 in 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 the weight is calculated: 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