• Resolved szymonwordpress

    (@szymonwordpress)


    Hello,

    im using the Relevassince since 6 months and it is doing great. But last time i noticed strange issue:

    I have a blog post with gutenberg product block into. I can’t find this post in search results (with Relevanssi enabled). Search results always show me the product, which is connected with product block in this article. This product doesn’t have any word in description or name which i’m trying to find in search bar (for example “optymalizacji”). When i’am switching off Relevanssi, i can find this post without problem. It looks like the Relevanssi keeps redirecting from the post to the product, which is in product block. I turned off “Expand shortcodes when indexing” option, and reindexed search results. Also i deleted web and object cache. It didn’t make the difference. Could you help me with that?

    Regards,

    Szymon

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

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

    (@msaari)

    Looks like there’s a hijack effect happening. That happens when a block or a shortcode has some kind of post loop in it, and changes the global $post object while Relevanssi is indexing the post. Relevanssi starts indexing the post 28207, but the post loop changes the post object during the indexing, and Relevanssi stores all information under the product post ID 19445.

    The solution – which you can’t implement – is to fix the block so that it doesn’t change the $post object; doing that is bad behaviour and Relevanssi is not the only plugin that it troubles.

    You can exclude the block from being indexed. This snippet will stop Relevanssi from indexing the woocommerce/single-product block, which should fix this problem:

    add_filter( 'relevanssi_block_to_render', function( $block ) {
    if ( 'woocommerce/single-product' === $block['blockName'] ) {
    return null;
    }
    return $block;
    } );
    Thread Starter szymonwordpress

    (@szymonwordpress)

    Thanks for the fast reply. I added your code to functions.php in child theme, but the problem still occurs 🙁

    Plugin Author Mikko Saari

    (@msaari)

    Did you rebuild the index after adding the code?

    Thread Starter szymonwordpress

    (@szymonwordpress)

    I rebuild it 1 week ago and it didn’t worked. Maybe because of object cache. I rebuild it today and it works! Thank you for your time!

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

The topic ‘Gutenberg product block problem’ is closed to new replies.