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 theme functions.php file:

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

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

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

    Simon

      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).

        Simon

  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.