• Resolved bkwineper

    (@bkwineper)


    It appears that Tablepress has some kind of conflict with the built-in search function in WordPress.

    When I have Tablepress active I frequently get timeout errors with the wordpress search.

    This, for instance, is a search that seems to consistently cause an error:
    https://www.bkwine.com/?s=robert+parker&lang=en

    The error I get is: “502 The page request was canceled because it took too long to complete. A request for either a page, script, process, or query has taken too long to complete and has been cancelled due to a bad gateway. You should visit your error log for more information.”

    Some other searches get the same error, while others work OK.

    When I deactivate Tablepress these errors disappear.

    My hoster (WPEngine) looked for errors and said this (it is on our Staging site so the URL is different, I have “hidden” the exact URL with [STAGINGSITEURL] since I don’t want to spread our staging URL unnecessarily):

    “The only one I can find related to that search is this WordPress database

    
    error MySQL server has gone away for query SELECT SQL_CALC_FOUND_ROWS wp_xgjhpw_posts.ID FROM wp_xgjhpw_posts LEFT JOIN wp_xgjhpw_icl_translations wpml_translations\n\t\t\t\t\t\t\tON wp_xgjhpw_posts.ID = wpml_translations.element_id\n\t\t\t\t\t\t\t\tAND wpml_translations.element_type = CONCAT('post_', wp_xgjhpw_posts.post_type) WHERE 1=1 AND (((wp_xgjhpw_posts.post_title LIKE '%robert%') OR (wp_xgjhpw_posts.post_excerpt LIKE '%robert%') OR (wp_xgjhpw_posts.post_content LIKE '%robert%') OR (wp_xgjhpw_posts.post_content REGEXP '\\\\[table id=(["\\']?)(29|39|42|58|59|98|112|117|134|143|144|150|152|159|160|174|182|189|201|202|229|236|264|271|274|280|288|290|309|311|331|339|347|348|354|368|378|380|389|391|417|424|463|489|495|503|505|506|519|520|528|532|539|565|566|588|589|590|610|623|637|640|642|656|657|659|685|686|694|698|706|710|713|714|718|737|746|750|760|766|773|790|795|796|803|804|809|814|816|817|822|837|842|843|844|845|846|866|867|872|889|893|897|900)([\\]"\\' /])')) AND ((wp_xgjhpw_posts.post_title LIKE '%parker%') OR (wp_xgjhpw_posts.post_excerpt LIKE '%parker%') OR (wp_xgjhpw_posts.post_content LIKE '%parker%') OR (wp_xgjhpw_posts.post_content REGEXP '\\\\[table id=(["\\']?)(681|873)([\\]"\\' /])'))) AND wp_xgjhpw_posts.post_type IN ('post', 'page', 'attachment') AND (wp_xgjhpw_posts.post_status = 'publish' OR wp_xgjhpw_posts.post_author = 3 AND wp_xgjhpw_posts.post_status = 'private') AND ( ( ( wpml_translations.language_code = 'en' OR (\n\t\t\t\t\twpml_translations.language_code = 'en'\n\t\t\t\t\tAND wp_xgjhpw_posts.post_type IN ( 'post','elementor_library' )\n\t\t\t\t\tAND ( ( \n\t\t\t( SELECT COUNT(element_id)\n\t\t\t FROM wp_xgjhpw_icl_translations\n\t\t\t WHERE trid = wpml_translations.trid\n\t\t\t AND language_code = 'en'\n\t\t\t) = 0\n\t\t\t ) OR ( \n\t\t\t( SELECT COUNT(element_id)\n\t\t\t\tFROM wp_xgjhpw_icl_translations t2\n\t\t\t\tJOIN wp_xgjhpw_posts p ON p.id = t2.element_id\n\t\t\t\tWHERE t2.trid = wpml_translations.trid\n\t\t\t\tAND t2.language_code = 'en'\n\t\t\t\tAND (\n\t\t\t\t\tp.post_status = 'publish' OR \n\t\t\t\t\tp.post_type='attachment' AND p.post_status = 'inherit'\n\t\t\t\t)\n\t\t\t) = 0 ) ) \n\t\t\t\t) ) AND wp_xgjhpw_posts.post_type IN ('post','page','wp_block','elementor_library' ) ) OR wp_xgjhpw_posts.post_type NOT IN ('post','page','wp_block','elementor_library' ) ) ORDER BY (CASE WHEN wp_xgjhpw_posts.post_title LIKE '%robert parker%' THEN 1 WHEN wp_xgjhpw_posts.post_title LIKE '%robert%' AND wp_xgjhpw_posts.post_title LIKE '%parker%' THEN 2 WHEN wp_xgjhpw_posts.post_title LIKE '%robert%' OR wp_xgjhpw_posts.post_title LIKE '%parker%' THEN 3 WHEN wp_xgjhpw_posts.post_excerpt LIKE '%robert parker%' THEN 4 WHEN wp_xgjhpw_posts.post_content LIKE '%robert parker%' THEN 5 ELSE 6 END), wp_xgjhpw_posts.post_date DESC LIMIT 0, 30 /* From [[STAGINGSITEURL].wpengine.com/?s=robert+parker&lang=en] in [/nas/content/live/[STAGINGSITEURL]/index.php:17] */ made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, referer: https://[STAGINGSITEURL].wpengine.com/
    
    • This topic was modified 5 years, 8 months ago by Yui.
    • This topic was modified 5 years, 8 months ago by Yui. Reason: please use CODE button for code formatting

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    My guess here is that these search words appear in may tables and therefore cause the slowdown. Unfortunately, the only suggestion I can make right now is to turn off TablePress’ integration into the WordPress search, which means that tables won’t be searched anymore.
    For that, please add this line of code to the “functions.php” file of your theme:

    add_filter( 'tablepress_wp_search_integration', '__return_false' );
    

    Regards,
    Tobias

    Thread Starter bkwineper

    (@bkwineper)

    Hi Tobias,

    Thanks for the feedback.

    You may be right. I know that both words – robert parker – do not appear many times in the tables I have. But just one of them – robert – may appear frequently. I tested a few other words that I know also appear many times in the tables (chateau, domaine) also caused the 502 error. So maybe you’re right.

    I have quite a lot of tables (800+) and each month we get 5-10 new ones.

    Excluding them from the search, as you suggest, is of course a possibility, but it would be a really bad thing for the site, since the info contained in the tables are quite important for the site and making them un-searchable would be take very negatively by our visitors.

    Could there be some other way to solve this problem?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    unfortunately, I’m not aware of other possibilities 🙁
    The only chance that I see would be switching from the WordPress search to something like the Google Site Search, i.e. an external search engine that indexes the “complete” pages (instead of the WordPress search, which has to gather the information from several SQL tables, in a complex SQL query).

    Regards,
    Tobias

    Thread Starter bkwineper

    (@bkwineper)

    OK. I’ll take a look at that. And see if I can find alternative solutions.

    It’s curious thought that not other people have experienced the same issue.

    /Per

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Per,

    there were a few similar reports in the past, but for them it was okay to turn off the search integration.

    I hope that you can find a good alternative!

    Best wishes,
    Tobias

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

The topic ‘Plugin conflicts with WP Search and causes 502 timeout errors’ is closed to new replies.