• Resolved ArcticFritid

    (@metuza)


    Hello,

    After the lates update i get my debug-log filled with the below database error:

    [26-Aug-2022 20:27:42 UTC] WordPress database error Unknown column 'relevanssi.doc' in 'where clause' for query SELECT COUNT(DISTINCT product_or_parent_id) as term_count, term_id as term_count_id FROM wp_relevanssi AS relevanssi, wp_wc_product_attributes_lookup 
    			 LEFT JOIN wp_term_relationships ON (wp_wc_product_attributes_lookup.product_or_parent_id = wp_term_relationships.object_id) 
    			INNER JOIN wp_posts ON wp_posts.ID = wp_wc_product_attributes_lookup.product_or_parent_id 
    			 WHERE relevanssi.doc = wp_posts.ID AND wp_posts.post_type IN ( 'product' )
    			AND wp_posts.post_status = 'publish'
    			 AND ( 
      wp_wc_product_attributes_lookup.product_or_parent_id NOT IN (
    				SELECT object_id
    				FROM wp_term_relationships
    				 WHERE relevanssi.doc = wp_posts.ID AND term_taxonomy_id IN (7)
    			) 
      AND 
      wp_term_relationships.term_taxonomy_id IN (16,273,274,275,276,277,278,279,280,282,301,316,317,318,319,320,321,322,323,330,331,332,333,334,335,337,338,339,340,368,369,370,375,376,377,378,379,396,397,398,399,453,454,455,456,462,497,574,694,940)
    ) 
    			AND wp_wc_product_attributes_lookup.taxonomy='pa_brand'
    			AND wp_wc_product_attributes_lookup.term_id IN (640,596,94,82,101,613,102,103,639,947,864,649,968,903,104,365,618,936,570,868,723,718,576,619,638,106,643,675,127,107,169,938,943,433,108,98,468,575,948,244,109,852,110,111,366,952,54,937,112,950,964,835,539,113,893,498,773,676,255,688,114,115,361,881,116,931,934,117,118,944,642,565,967,328,939,197,862,894,119,517,199,44,892,840,726,824,120,327,564,121,873,612,241,942,122,966,123,860,839,732,965,464,124,738,242,951,572,125,95,42,126,623)
    			
    						AND product_or_parent_id IN ( SELECT product_or_parent_id FROM (
    							SELECT product_or_parent_id
    							FROM wp_wc_product_attributes_lookup lt
    							 WHERE relevanssi.doc = wp_posts.ID AND is_variation_attribute=0
    							
    							AND term_id in (202)
    							GROUP BY product_id
    							HAVING COUNT(product_id)=1
    							UNION
    							SELECT product_or_parent_id
    							FROM wp_wc_product_attributes_lookup lt
    							 WHERE relevanssi.doc = wp_posts.ID AND is_variation_attribute=1
    							
    							AND term_id in (202)
    						) temp ) GROUP BY wp_wc_product_attributes_lookup.term_id made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/taxonomy-product-cat.php'), wc_get_template, include('/themes/woodmart/woocommerce/archive-product.php'), do_action('woocommerce_sidebar'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_get_sidebar, wc_get_template, include('/plugins/woocommerce/templates/global/sidebar.php'), get_sidebar, locate_template, load_template, require_once('/themes/woodmart/sidebar.php'), dynamic_sidebar, WP_Widget->display_callback, WOODMART_Widget_Layered_Nav->widget, WOODMART_Widget_Layered_Nav->layered_nav_list, WOODMART_Widget_Layered_Nav->get_filtered_term_product_counts, Automattic\WooCommerce\Internal\ProductAttributesLookup\Filterer->get_filtered_term_product_counts

    Do you have any idea what can cause this?

    Brgds
    Rune

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes. Relevanssi added some new code to make the WooCommerce layered navigation work better with Relevanssi.

    Adding this snippet should fix this problem:

    add_action( 'init', function() {
    	remove_filter( 'woocommerce_get_filtered_term_product_counts_query', 'relevanssi_filtered_term_product_counts_query' );
    }, 9999 );

    Are you using just the normal WooCommerce layered navigation widget, or are you using something else?

    Thread Starter ArcticFritid

    (@metuza)

    I am using layered nav widget by woodmart theme. I just found that i not have these problems with my second website using the same theme and mostly the same setup.

    So in my problem-site i deactivated / activated Relevanssi, resaved options and rebuilt the index.

    So far it seems like verything works ok, fast search query and no more database errors in my debug-log.

    I’ll keep an eye on this.

    Thanks

    Brgds
    Rune

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Database error after latest update’ is closed to new replies.