• Hi,

    My problem is the following. I have a webshop with about 1600 products. The AJAX search works well, but there’s a problem at the search result page.

    1) If I disable the max 100 limit for the search results with a snippet I found here (add_filter(‘aws_page_results’, ‘my_aws_page_results’); function my_aws_page_results( $num ) { return 999;}) then all those searches that have more than 100 results come back with an error message (just the message “There has been a critical error on your website.” + a “Learn more about debugging in WordPress.” link – and I can’t find a debug file for a detailed error).

    2) If I leave the limit as is (max 100) then the searches that have more than 100 but less than 200 work well (of course only showing 100 results), but the others cause the above mentioned error (it’s weird, but there’s a search with 381 and another with 730 results that works…).

    What could cause this problem and how can it be solved?

    Thanks

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    So you enable debug mode by following this article but can’t find the debug.log file? Usually it is inside the wp-content folder. Do you see it there?

    Also the problem can be caused by larger plugin database size. Please tell me how many products do you have in your store?

    Regards

    Thread Starter dinyus

    (@dinyus)

    Hi,

    Yes, I enable debug mode in that way, but there is no debug.log anywhere on the server…

    I have around 1600 products, and there will be more.

    Thanks

    Plugin Author ILLID

    (@mihail-barinov)

    Well one of the problems can be large database size. It is possible to decrease its size but first please tell me what search sources you are using for searching ( like title, product content, etc. ).

    Regards

    Thread Starter dinyus

    (@dinyus)

    Title, content, short description, category, tag.

    Plugin Author ILLID

    (@mihail-barinov)

    Please use following code snippet

    add_filter('aws_indexed_data', 'my_aws_indexed_data');
    function my_aws_indexed_data( $data ) {
        $new_data = array();
        foreach ( $data['terms'] as $source => $all_terms ) {
            if ( strpos( $source, 'title' ) === 0 || strpos( $source, 'content' ) === 0 || strpos( $source, 'excerpt' ) === 0 || strpos( $source, 'category' ) === 0 || strpos( $source, 'tag' ) === 0 ) {
                $new_data[$source] = $all_terms;
            }
        }
        $data['terms'] = $new_data;
        return $data;
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.
    Also, after adding this code, you need to re-index the plugin table.

    Thread Starter dinyus

    (@dinyus)

    I tried it and it doesn’t work. šŸ™

    I put the snippet in my child theme’s function.php (here’s the screenshot, it’s just after the snippet which you posted about making the 100 limit higher: https://www.dropbox.com/s/avn501415tmdavy/snippet.png?dl=0)
    I also did the reindexing in the plugin, then refreshed the page, but the error message is the same as before on the search result page:
    https://www.dropbox.com/s/7ovyl1p2tmkljul/errormsg.png?dl=0

    Plugin Author ILLID

    (@mihail-barinov)

    Ok, I understand. Please tell me what plugin version you are using – free or pro?

    Thread Starter dinyus

    (@dinyus)

    2.11 (I updated it today), free version.

    Plugin Author ILLID

    (@mihail-barinov)

    In this case maybe you can use https://wordpress.org/plugins/debug-bar/ plugin to find eny errors if debug mode is not working for you?

    Thread Starter dinyus

    (@dinyus)

    Sorry, no luck with this either. šŸ™ I don’t understand what the error can be and why I can’t log it…

    Plugin Author ILLID

    (@mihail-barinov)

    Ok, maybe than you can check for php errors inside your server logs?

    Thread Starter dinyus

    (@dinyus)

    No errors there either. šŸ™ I’m completely lost. Now my page is doing the same error message sometimes when I just click to go to another page… I was thinking: can it be a database error?

    Plugin Author ILLID

    (@mihail-barinov)

    You mean another page not related to the search results page?

    Hard to say what exactly went wrong. So what about server logs – can you look on them?

    Thread Starter dinyus

    (@dinyus)

    OK, problem solved. šŸ™‚
    I checked all the other plugins (could’ve done it before…). I’m using Smart Image Resize PRO so the thumbnails on the listing pages aren’t cropped, and it has some image size reducing options as well, and if I disable WebP format for the images, then the search works fine even with many products.
    So there’s somehow a problem with WebP images – I don’t know if this is something you have to solve in your plugin.
    Thanks for all the help and ideas!

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Too much results cause error message’ is closed to new replies.