• Hi Team,

    Could you please advise if there’s a way to set a maximum search time before either returning the most relevant results (this would be ideal) or simply returning no results (this would be acceptable)? I’m running into an issue whereby if I search for a word that has NO results or TOO MANY results, the site keeps spinning and/or returns a 500 error. I’ve tried several different Settings permutations (including disabling/enabling the following: seamless integration, mySQL FULLTEXT, BOOLEAN mode, etc.), but no combination works. Is there a way for me to tell the plugin that after, say, 30 seconds of searching all post types, to just stop, and either return no results or just the ones that were far found so far (and simply stop searching the rest of the site)?

    Thanks very much in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @matthewdhuntley

    I in no way want to claim that indexed search is somehow better or worse than the built-in MySQL functionality, but trying it out may partly solve your problem.

    https://www.ads-software.com/plugins/fulltext-search/


    This is our free plugin that we have been developing for many years, its principle is to build a search index based on words. This allows you to make a search very fast, 2 seconds per search is already a very long time, the average search time varies around 0.5-1 second (depending on the number of documents on the site).

    I apologize in advance to the author of Better Search for entering someone else’s territory; this is not an advertisement, but simply an attempt to help. Since many years ago I encountered a similar problem and there was no one to help me, I had to reinvent the wheel and write my own solution.

    Indexed search is not perfect. It creates a large amount of secondary data and huge additional tables. But if the speed and quality of search is important to you, this is a justified sacrifice.

    Plugin Author Ajay

    (@ajay)

    @matthewdhuntley,

    There seems to be a bigger underlying issue if you’re getting a timeout on the search results. While a fulltext search will take time on first load, if you enable caching this massively speeds up subsequent searches. The fact that you’ve turned off mySQL Fulltext and still getting this error points to another underlying issue. My feeling is that something is causing a infinite loop that is causing the search results to break down.

    Can I have your site URL to check. By any chance do you have any other search plugins enabled? And, if so can you turn it off?

    Thread Starter matthewdhuntley

    (@matthewdhuntley)

    Hi @ajay, thanks for your response. I unfortunately cannot share with you the URL because it is an internal government site, but what’s perplexing is that the 500 error only occurs when certain keywords, such as “news” and “tools”, are searched for (these would like return several results). I’ve confirmed there are no other search plugins enabled. If a 500 error is received, I assume this would be logged on the server hosting the site, which is where I’ll troubleshoot next. Just to confirm, have you ever heard of this issue before?

    Plugin Author Ajay

    (@ajay)

    Not with this plugin – and it seems rather specific. The only times I see these time out errors is when it code goes into a loop and the PHP process runs out of the max execution time. I think this would be in the log. Are you currently building the site out and by any chance do you have ability to turn plugins off/switch themes? Trying to figure out if something gets excited by these words, hooks (probably a filter or action) and then throws Better Search into a loop.
    I assume you’ve tested with my plugin off that the error goes away?

    Thread Starter matthewdhuntley

    (@matthewdhuntley)

    Hi?@ajay, thanks again for the response. I’m finding at least three different plugins are causing “PHP Fatal error”s on the site, specifically, “Maximum execution time of 300 seconds exceeded.” Full disclosure: there appears to be a confict between Better Search and Smart Slider 3. As I conduct more testing, I’ll share more details for your visibility (in case this ever comes up for another user).

    Plugin Author Ajay

    (@ajay)

    That seems like a wider issue – but what is it that you’re seeing as a conflict with Smart Slider 3. They seem to have a free version so I can try to give it a test.

    Thread Starter matthewdhuntley

    (@matthewdhuntley)

    This is likely exclusive to our site, but the issue is that when searching for for a term that would render a lot of results (in our case, “news” and “tools”), and only when both Better Search and Smart Slider 3 are activated, the site renders a 500 error, and we see these types of errors in the logs:
    [27-Feb-2024 14:12:14 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 90112 bytes) in …\csmstage\wp-content\plugins\smart-slider-3\Nextend\WordPress\OutputBuffer.php on line 226
    [27-Feb-2024 15:20:04 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in …\wp-includes\class-wp-hook.php on line 118

    Plugin Author Ajay

    (@ajay)

    And when you have Better Search turned off, I assume this works without the output buffer error you see?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Set maximum search time’ is closed to new replies.