Posted on

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 site:

add_filter( 'pre_option_relevanssi_throttle_limit', function( $limit ) { return 250; } );

If necessary, you can adjust the value (250) to a lower number. Anything over 100 should be safe.

Throttle and termless searches

The throttle is always on when there’s no search term involved in the search. Otherwise, the search would return all posts on the site as a result. That’s too much. If you, for some reason, want to disable the throttle completely in all cases, you can use this line:

remove_filter( 'relevanssi_query_filter', 'relevanssi_limit_filter' );

7 comments Adjusting search throttle

  1. Hey there.

    We’re running out of memory when searching.

    I tried:
    add_filter( ‘pre_option_relevanssi_throttle_limit’, function( $limit ) { return 250; } );

    but that gives me:

    Parse error: syntax error, unexpected ‘250’ (T_LNUMBER) in /home/otsnew/public_html/wp-content/themes/Divi-child/functions.php on line 3

    Does this line need to be revised?

    Thank kyou


      1. Thanks, that fixed it. I went through deleting and recreating the spaces. Strange though, I used the copy function on the web page.

        Still running out of memory though. I even set the throttle down to 10. Is there anything else it could be?

        Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /home/otsnew/public_html/wp-includes/post.php on line 2516

        1. (There was a shift-space in the sample code. I’ve removed it now.)

          Relevanssi in general isn’t very memory intensive. Even on a larger site, the Relevanssi search memory requirements are measured in tens of megabytes. If you’re running out of a gigabyte of memory, there are some larger issues on your site. I’d investigate what is taking up all that memory. It’s not Relevanssi.

          One thing you can do in Relevanssi is to disable custom excerpts if you’re using them.

      2. Thank you for that.

        I disabled Relevanssi and found that yes, we still have the issue with searches.

        I tracked the issue down to ocurring when we have Ultimate Member enabled. We have member only content on the site, are there any known issues or conflicts with searches and Ultimate Member (I realize its not a Relevanssi issue now, just wondering if it has come up before).


  2. For what its worth, this is our index state:

    10670 documents in the index.
    0 users in the index.
    0 taxonomy terms in the index.

    613260 terms in the index.
    2 is the lowest post ID indexed.

Leave a Reply

Are you a Relevanssi Premium customer looking for support? Please use the Premium support form.

Your email address will not be published. Required fields are marked *