Posted on

Adjusting search throttle

If Relevanssi Premium has memory issues, make sure you have the “Limit searches” option checked. It is a very important setting, which probably should be on by default.

However, if that doesn’t work, and you’re still getting out of memory issues, you can try making the limit tighter. The limit can be adjusted with a simple PHP function.

remove_filter('relevanssi_query_filter', 'relevanssi_limit_filter');
add_filter('relevanssi_query_filter', 'tighter_relevanssi_limit_filter');
function tighter_relevanssi_limit_filter($query) {
    return $query . " ORDER BY tf DESC LIMIT 250";
}

You can adjust the value (250) to lower number if necessary. Anything over 100 should be safe what comes to the search finding the most relevant posts.